Passing argument from workflow event activity to Script action

veeresh3
Tera Expert

Hi All,

Thanks for reading this.

I want to pass variable value from   workflow event activity to Script action for processing and getting the dynamic values for the my code.

for example: (Assumned that i have one variable in item)While Event activity occurs in the workflow,it call the script action script(Now i am using static data to process).Now i want to send the dynamic variable values to script action.

And how to set that passed varibale value in the below URL.

https://dhcp-manager.net.hban.us/wapi/v1.4.1/ipv4address?network=10.180.100.0/27&ip_address=10.180.1...

in the above URL the 10.180.100.0   is the static value. i want replace that value with my variable value.

I hope i made it clear here.

Please help me to resolve.

Thanks in Advence.

Thanks,

Veeresh

1 ACCEPTED SOLUTION

andrew_lawlor
Giga Expert

From your 'Create Event' activity, select your event name in the reference field. You can pass your catalog variable to your script action using either Parameter 1 or Parameter 2 - simply insert JavasScript into those fields to make it dynamic: ${workflow.variables.yourVariableName}



As for appending the parameter value to the URL you posted above - simply concatenate the strings: var myURL = 'https://dhcp-manager.net.hban.us/wapi/v1.4.1/ipv4address?network=10.180.100.0/27&ip_address=' + yourParameter;


View solution in original post

9 REPLIES 9

I may be off base here, but how can I grab a variable's data for the current object?


You're not off-base. If the current object is an RITM, you can access its variables via the following syntax:



var myVar = current.variables.myVariable;


Where 'myVariable' is the name of your variable. If the variable stores a sys_id, you may use the getDisplayValue() function to retrieve its human-readable value:



var myVar = current.variables.myVariable.getDisplayValue();


And by returning my sys_id's name into the variable, I can then return that variable into Parameter 1 of my "Create Event" properties in my workflow, to bring across to my notification firing off the new event?



Edit: Tried it, that is indeed working. The sys_id for the user is allowing the email to send to the right person. If I now wanted to embed a sysparm value into a URL for the email that is firing, does that have to be done in a mailscript, or can it be done directly in the email notification? Do you have an idea how can I can parse my current workflow's variables back into that URL? Ideally I wanted to pull a "new hire name" variable, put it into the URL that is heading to an order guide, then use a script to parse that info from the URL and fill it into a field on a new order guide/catalog item.


Hi Andrew,



Can we use the same logic for triggering event using Business rule and script action .



How is the update to URL done .


veeresh3
Tera Expert

Hi Andrew,



Thanks you so much.


I really appreciate you.



Thanks,


Veeresh