Write a value to a Workflow Input Variable (Query AD Orchestration Workflow Activity)

Basim Zaidi
Mega Expert

Hi,

I'm trying to write a value to a Workflow Input Variable.  I was hoping for it to be straightforward, e.g. if the Input Variable was a string field called u_test, within a Run Script activity in the workflow the code would look something like this:

workflow.inputs.u_test = "Hello World";

Ultimately I want a Input Variable to reference the User table, and the person specified in the Request Item's variable (RequestedFor) to be written to the Workflow Input Variable so that the Input's value can be called upon later in the Workflow by an AD Query Orchestration activity.

Any help would be much appreciated!

Thanks

Basim

🙂

3 REPLIES 3

Steven Parker
Giga Sage

If you are going to be using the "Requested For" variable in the same workflow that the Requested Item is running on just set it to a scratchpad variable in your Run Script:

workflow.scratchpad.requested_for = current.variables.RequestedFor; //Will give you sys_id if RequestedFor is a reference field - .getDisplayValue() on the end will give you the text instead of the sys_id.

Then you can use the scratchpad variable later in the workflow, such as in an AD Query Orchestration activity.

 


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Hi Steven,

Many thanks for taking the time to reply!

I've tried writing to scratchpad as follows:

workflow.scratchpad.user=current.variables.RequestedFor.email;

Then I have called this in a Query AD Orchestration activity later is the workflow:

find_real_file.png

But this activity is failing with a *horrible* error message which reads:

An operations error occurred.Stack Trace: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)at System.DirectoryServices.DirectoryEntry.Bind()at System.DirectoryServices.DirectoryEntry.get_AdsObject()at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)at CallSite.Target(Closure , CallSite , Object )

 

Any ideas what I need to change to fix?  It may be worth noting this activity stopped working when we upgraded from Istanbul to Kingston.

 

I think the MID server authenticates fine to the domain controller so I'm thinking it's got to be something to do with the search filter (as in the image above)?  That's why I thought it would be a good idea to try copying the Requested For item variable's display value to the Workflow Input Variable, and then call the Input Variable from within this Query AD activity, e.g.

${workflow.inputs.u_requestedfor.ldap_server.server_url}

(When attempting this I gave the item variable and input variable the exact same name of u_requestedfor and also tried writing the text "Hello World" to a u_test WF input string variable (as in my initial post).

If you know of a way to write an item variable's value to the WF input variable, it gives me something to try!

The only way I have ever used Workflow Inputs is when I have a sub workflow within another workflow.  Then you pass the sub workflow the variables it needs through workflow inputs.  

Here is a screenshot of a workflow inside of another workflow and what the screen looks like when you double click that sub workflow.  Those are workflow inputs on the sub workflow and I am passing variables to the inputs using scratchpad variables:

Have you tried a simpler search filter?  Just something easy that you know works to make sure the activity works for you in Kingston?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven