- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 10:32 AM - edited ‎08-09-2023 10:35 AM
Hello,
Sourcing tasks do not have the RITM already prefilled. Because of this we, need to open the REQ and see what the RITM number is, copy it, go back to the task and paste it just to source an item. Attached screenshot
Note: The task is to created based on Request table workflow not RITM Workflow. so RITM number is not auto populated.
Can anyone suggest me the script to autopopulate the RITM Number in Task record
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 12:21 PM
Ok .
Create after insert BR on sc_task and add following script in it:
var getRITM = new GlideRecord('sc_req_item');
getRITM.addQuery('request',current.request);
getRITM.query();
if(getRITM.next()){
current.request_item = getRITM.sys_id;
current.update();
}
and then test !
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 10:34 AM
Are you using legacy workflow or flow designer for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 10:36 AM
We are using workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 10:52 AM
See you can have a after insert BR on sc_task which can look for RITM created from request.
But you will face an issue when you will come across order guide when there are multiple RITMs are present below request.
So considering this fact and issue you are into I might have suggested to make this BR only run for specific catalog item but neither sc_request OR sc_task has item field which can tell you details about catalog item (OOB).
Because of this I think you need to shift your workflow on sc_req_item, which will automatically solve your problem.
There is a possibility of using parent field from sc_task, can you check if it is empty OR have request populated? if empty or request number is there then you have no other option apart from shifting the workflow to sc_req_item BUT if it has RITM number populated (which likely not) then in after insert BR on sc_task, you can set value of requested item from parent field (with condition of catalog item . walked from parent).
Hope you get it
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 11:08 AM
I cant shift the workflow to sc_req_item table because we have another workflow for RITM Table.
RITM approval is approved after that request table workflow task will trigger based on two conditions:
If the request is sourceable and approval is approved
If this two conditions matches that request table workflow task will trigger