Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Facing Problem in accessing Designer Variable in Script

Avatar

Former Community Member
Hello all,

We are trying to extract designer variable in script using the sample code provided by WFS

"import com.adobe.pof.omapi.POFObjectManager;



import com.adobe.workflow.manager.ProcessManager;



POFObjectManager _om = patServiceContext.getObjectManager();



ProcessManager _pm = patServiceContext.getProcessManager();



patExecContext.setProcessDataStringValue("/process_data/status", "approved");



String str1 = patExecContext.getProcessDataStringValue("/process_data/status");



System.out.println("status is now " + str1);"



But we are not getting any output we tried to used our own variable also our code is getting failed after "patExecContext.setProcessDataStringValue("/process_data/status", "approved"); " this line.



Any suggestion ??
5 Replies

Avatar

Level 9
Hi



Your xpath expression is incorrect - scalar variables are preceded by an "@". ie "/process_data/@status". This will fail with an exception (VariableNotFound or something similar), which is why the rest of your code is not running.



I also think that you will find that getting a value that you've just set will still get the original value of the variable, not the new value. The value isn't committed until the step completes. (Not sure about this, but just letting you know so that you're not surprised.)



Also, the first 4 lines of your script are not required.



What are you trying to achieve?

The script QPAC is quite difficult to use, because it has only a very minimal dev/test/debug environment.

You may be better off with a pre-built QPAC (we have lots that do useful things), or a custom QPAC (which we're happy to build for you, or you can have a go yourself.)



Howard



Howard Treisman

Avoka Technologies

Specializing in Custom QPAC development and LiveCycle Solutions

http://www.avoka.com/avoka/qpac_library.shtml

Avatar

Former Community Member
Hi Howard,



We tried to use "@" also but it is also not working.

By using script QPAC

We are trying to validate a set of user id which is entered by initial user who initiated the workflow and if all the users are in LDAP then only workflow will going to be submitted. Any other alternative you can suggest?

Avatar

Former Community Member
Howard's correct it should be "/process_data/@status". What is the exception that you are getting?



H.

Avatar

Level 9
Hi



I'll look into why the script isn't working. It looks right to me.



If you're trying to validate users, I suggest several options:

1. Try our UserLookup QPAC. It's currently in beta, you can download it from: http://www.avoka.com/betaqpacs/QPAC_lookupuser.jar This returns all sorts of useful information for a user, including whether the user was found.



2. If the number of users is not too great, you should consider pre-populating combo-boxes with the user names - this way, users of your form would be selecting from a list of known users, and you should not have to validate at all. We do not currently have a QPAC that returns a list of users, but we would be happy to build that and add it to our list of standard QPACs if you want it.



3. If you want to validate multiple users at the same time, we could build you a variation on UserLookup that validates multiple users at the same time.



4. Another alternative would be to buid a web service that validates a user, and put a "Validate" button on your form that invokes that. That way, the user info would be validated before the form gets submitted. You could quite easily build this web service using a simple workflow and the User Lookup QPAC. The advantage of this is that you could populate non-editable fields on your form with the users first and last name, email address, etc. This way, your users would be sure that they're typing the correct user names.



I hope this all makes sense...



Howard

Avatar

Level 9
Hi



You should not be using the "status" variable - this is an internal variable used by the workflow engine. It's also an integer, and you're trying to set it using a string. Try creating your own string variable, and getting/setting that.



You should also use the Test tab.

To use the Test Tab of the Script QPAC:



Download our SQLPlus QPAC from the web site at: http://www.avoka.com/avoka/qpac_library.shtml



It has instructions for running the Designer with a Java console. This will enable you to use the Test tab, and see any exceptions on the console.



Add the following two jars into the "extras" directory specified in the instructions:

- datamanager-client.jar

- adobe-common.jar



You'll find these by doing a search in: C:\Adobe\LiveCycle\components



Then run the Designer with the Java console.



I hope this helps...



Howard