- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2019 03:58 AM
- i have created a work flow and that needs to be triggered from the business rule and need to pass values to the workflow and need to fetch that values and display in the workflow ,
i tried many ways i'm able to trigger the workflow , but not able to fetch the values that are being passed from the business rule .
-------
code that i'm using for calling a workflow is ---
var w = new Workflow();
var vars = {"name":"shankar","age":25};
w.startFlow('f2732b8adba633003cea0181ca9619d0', ' ', 'workflow name', vars);
----------
inside the workflow [ Run Script ] i'm using the below code to fetch the values , please help
gs.log("username is -"+ workflow.variables.name);
please check the code and provide solution.
Solved! Go to Solution.
- Labels:
-
Cost Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2019 04:00 AM
Hi Sreek,
have you configured the workflow input variables in the workflow and it should work
https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/administer/using-workflows/task/t_WorkflowInputVariables.html
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2019 04:00 AM
Hi Sreek,
have you configured the workflow input variables in the workflow and it should work
https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/administer/using-workflows/task/t_WorkflowInputVariables.html
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 12:23 AM
Hi Ankur ,Thank for the answer ,
yes , i have used the input variable in the workflow ,
but while passing the value from the business rule i have not used the same id of the input variable.
after using the same id of the input variable that i have created , it is working fine .
before modification
var w = new Workflow();
var vars = {"name":"shankar"};
w.startFlow('f2732b8adba633003cea0181ca9619d0', ' ', 'workflow name', vars);
in place of 'name' i have provided the input variable id 'u_name'
after modification
var w = new Workflow();
var vars = {"u_name":"shankar"}; // here i have modified
w.startFlow('f2732b8adba633003cea0181ca9619d0', ' ', 'workflow name', vars);
added the logs in workflow runscript ...
gs.log("username is -"+ workflow.variables.u_name);
working as expected ..