- 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-27-2020 02:06 AM
- 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-27-2020 03:28 AM
If you're getting 'undefined' in the variable on the catalog task and RITM, then there's a typo. Even if recurring_price is not set/changed on this catalog item it would still show 0. If it showed nothing, then there's another issue, but 'undefined' can only mean the right side of the equation is wrong
= current.cat_item.recurring_price.toString();
I'm confused why you only want this variable to show on the catalog task, but you're not populating it until the task is closed. It seems like the person fulfilling the task might try to populate it since it's showing, but they won't see the value from the catalog item unless they go back into the task - but whatever works for your use case.