Message in SCTASK Worknotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 02:25 AM - edited 10-16-2023 02:26 AM
Hi Team ,
We have requirement that
You can see here 2 sctasks got generated as per the WF .
For eg
1 . SCTASK0001
2 . SCTASK0002
Our requirement , In the 2nd SCTASK Work notes we need to display message ( ' Please review the attachment on the # SCTASK Dynamically [ Here 1st SCTASK number should come ] ) .
I.e - Please review the attachment on the SCTASK0001
How achieve this requirement please help me with screenshots for better understanding .
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 08:25 PM
both catalog item and workflow should be in same scope. If they are not currently you need to ensure this and then the script I shared will work fine
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 08:51 PM - edited 10-16-2023 08:57 PM
Both catalog and WF are in same scope . then also getting same error .
Business rule can we try here .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 09:17 PM
yes you can use before insert BR on sc_task
Condition: current.request_item.cat_item.name == 'Your Catalog Item Name Here'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sc_task");
gr.orderBy("sys_created_on");
gr.addQuery("request_item", current.sys_id);
gr.setLimit(1);
gr.query();
if (gr.next()) {
current.work_notes = "Please review the attachment on the " + gr.number;
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader