Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Retrieving user list from Workflow Server onto Form

Not applicable
Does anybody know how to get the list of workflow users into a list box on a form? In Workflow Server Designer 6.1, I found something in the Script Assistant for BasicScript called jfUsers.Names which says that it returns a semi-colon delimited list of users, so I tried to write this list to a list box on my form called "cboDistribution" by putting the following code on the On Open event of my first task in the workflow process:



Task.SetFieldData "cboDistribution", jfUsers.Names



However, when I initiate my process, Workflow Server gives me the following message in my browser:



The user record corresponding to user number '{33}' could not be found. Click here for more information.



When I click 'here' it pops up an Internet Explorer message box saying "An internal error has occured."



I think I need to assign something to the jfUsers object, but I'm not sure what. Any ideas?



Thanks.
3 Replies
Not applicable
Perry,<br /><br />I have not done this in BasicScript since Jscript support arrived, as it is my understanding that eventually support for BasicScript will be removed. (Not sure about this, but it gave us an excuse to move to JScript.)<br /><br />There are a couple of ways you could do this: <br /><br />Firstly, you could do this using the Adobe Workflow Server Driver and an event (such as button click or form load) to build a query on the form to populate the list of users. This is the method I have used where there are loads of users, and I need to allow for search functionality such as people with last name starting with 'SMITH' or something. (but only execute on server side, and where server can be secured appropriately.)<br /><br />Secondly, when you want to prepopulate a dropdown from the process map, there are a couple of things you need to be aware of. <br /><br />You could either use the XFA interface and XML, and just add list of users to the data model. (Read DataHandling.pdf for more info on this, it is distributed with workflow server 6.2 at least)<br /><br />Or you could (and I am assuming FormServer forms, here, this would not work for other types of forms) use a script to build a string containing all your users, and store the list in the <fieldname>_ITEMS_ field. <br /><br />The names in the list would have to be separated with a string of ;!!; which is what formserver uses internally.<br />so in your case you'd put the sting into cboDistribution_ITEMS_ field.<br /><br />Here is a sample Jscript:<br />var key = new Array();<br />var value = new Array();<br />key[0] = "IsEnabled"; value[0] = "true"; //only include enabled participants<br />key[1] = "IsOutOfOffice"; value[1] = "false"; //only include those that are currently in the office<br />key[2] = "IsParticipator"; value[2] = "true"; //only include those that are allowed to participate<br />//add other criteria as required<br /><br />//find all users that match the criteria<br />var oParticipants = Directory.findAllUsers(key,value);<br />//check out how many were returned<br />var sNameCount =oParticipants.length; <br />var sNameList = "";<br />var i = 0;<br />for (i==0;i<sNameCount;i++)<br />{<br /> sNameList = sNameList + ";!!;" + oParticipants.item(i).name;<br />}<br />WorkItem.setFieldValue("cboDistribution", sNameList);<br />//this will include an empty line at the top of the list, and items are not sorted.<br /><br />Hope this helps,<br />Sanna
Not applicable
Sanna,



I want to execute thhe above jscript from a click of a button (it is not a submit button) and populate the values in the list box. Can you kindly let me know what i have to do for this?
Not applicable
Hariharan,



The code I included uses Workflow server objects, and will not be available on the form directly. For achieving the same on the form, you will need to open up a database connection to the workflow server database (if you use the workflow agent driver, you can use the documented table descriptions, see pdf documentation that arrived with the product.) and create a local script to loop through and build the list.



I don't have a sample at hand just at the moment, but we have been able to implement this before using the documentation.



Do you need to do it from the form for a reason such as including a filter of some sort?