- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 06:38 AM
Hi ,
I am trying to create a variable set that is visible only on sc_task, when the task is closed, it should pull the recurring price value mentioned when the catalog item is created (sc_cat_item). How to acieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 02:28 AM
Hi,
ok so in the run script after the task is complete the script is added
please find the below code
Ensure you add current.setWorkflow(false);
current.variables.recurring_price = current.cat_item.recurring_price.toString();
current.setWorkflow(false);
current.update();
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
05-26-2020 08:50 AM
Hi,
I'm thinking that with a client script you will have no access to that information so maybe better with a business rule which code should be as simple as:
current.your_variable_name = current.cat_item.recurring_price;
You'll need to specify in the conditions on "When to run" tab
Regards:
Joaquín
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:10 AM
This didnt work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:00 AM
To make variables in a variable set only visible on task(s), add the variable set to your catalog item, then create a UI policy to hide it on the Catalog Item view and Requested Item
Select the variable(s) in the Catalog Task definition slush bucket at the bottom, so that it/they will appear on the task. In the workflow, after the Catalog Task, add a Run Script activity. Your script will look something like this, depending on the variable name that you want to populate.
current.variables.recurring_price = current.cat_item.recurring_price.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:54 AM
The value population didnt work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 11:05 AM
Add a second line to the script
current.update();
This usually isn't needed/wanted in a workflow run script, but in this case it seems to be necessary.