- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 07:45 AM
Hi Developers,
I have requirements,
1. When user raise a catalog item in that added any attachment, the attachment is updates in REQ level.
2. In REQ level, approver added work notes or attached the attachment, these updates in RITM level ( portal level also).
3. Requester added attachment and work notes, need to update in sc_task level.
for this sc_task level requirement, I wrote BS, but it is not working as expected.
please can anyone help on this requirements.
table : sc_req_item
when : after
update : check
insert : check
condition : current.work_notes.changes()
script :
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord('sc_task');
if (gr.get(current.parent)) {
gr.work_notes = current.work_notes;
gr.update();
}
})(current, previous);
but the above one not working as expected.
Thank you,
Priya.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 08:06 AM
Hi @priyakakarla20
I have implemented the same with same conditions
result screenshot:
Please hit the thumbs up button and click upon solution provided. Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 08:06 AM
Hi @priyakakarla20
I have implemented the same with same conditions
result screenshot:
Please hit the thumbs up button and click upon solution provided. Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 08:21 AM
HI @priyakakarla20 ,
I trust you are doing great.
Based on your requirements, I understand that you want to achieve the following:
- When a user raises a catalog item with an attachment, the attachment should be updated at the request (REQ) level.
- If an approver adds work notes or attaches an attachment at the request (REQ) level, these updates should be reflected at the request item (RITM) level, including the portal.
- When the requester adds an attachment and work notes, they should be updated at the task (sc_task) level.
To address the requirement at the sc_task level, you have written a business script, but it's not working as expected. Let me provide you with an alternative solution to achieve this.
(function executeRule(current, previous /*null when async*/ ) {
var reqItemGr = new GlideRecord('sc_req_item');
if (reqItemGr.get(current.parent)) {
var taskGr = new GlideRecord('sc_task');
taskGr.addQuery('request_item', reqItemGr.sys_id);
taskGr.query();
while (taskGr.next()) {
taskGr.work_notes = current.work_notes;
taskGr.update();
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi