A Forum reader recently asked:
“I have a workflow where a manager can select a user and the applications they have access to. (The applications are in a checkbox pick list from a global query on load.) On the approval form, I can display the values I want with entity key for DN expression lookup; but I am unable to figure out a few things past that.
1) How do i automatically have the “chosen” applications from the request form to show up “checked” on the approval form?
2) I know how to use the display expression to show the values I want, but I want to be able to set a different value (not the DN) on my entity action. Basically, I want to read my application object for the CN value and place that on my user object.”
And here’s the response from Rudy Duym …
You can use the field.select() or form.select() method : field.select(/*string? || array?*/ values)
This highlights the entered text if the control is a Text, DNMaker, DatePicker or TextArea control. For list or choice-based controls, this will select the choice(s) corresponding to the values parameter. If no values are passed in, the first field option will be selected.
Note: When an array of values is passed in only the first value will be considered. This will be without effect on disabled or invisible fields. This can also trigger the onchange event for the current field.
field.select("a"); // select the option "a" in a StaticList field.select(["choice1", "choice2"]); // preselects 2 choices in a PickList of MVCheckbox
As to your second question, maybe you can use IDVault.get() to get the cn value either in the form or in one of the workflow mappings. For example:
/*array*/ IDVault.get(/*string?*/ fieldname, /*string*/ dn, /*string*/ entity_key, /*string*/ attribute_key)
This corresponds to the IDVault.get() function of the workflow script engine. It retrieves the value(s) of the attribute for the given entity. The result will be an array of values. If the “field” parameter is specified, the result of the query will be used to refresh the content of the field. If you specify a null value for the fieldname, it will be up to the form developer to use the result of the query.
The method returns an array with the data values. For example:
var s = IDVault.get(null, dn, "user", "LastName"); field.setValues(s); // s contains values for last name
Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment. It just worked for at least one person, and perhaps it will be useful for you too. Be sure to test in a non-production environment.