
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 12:57 PM - edited 12-09-2022 01:04 PM
Is there a way to grab special instructions from the request container and apply it to comments of the requested item? For example:
current.comments = current.parent_request.special_instructions
thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2022 04:44 AM
You shouldn't ever need to do a GR on sc_req_item to retrieve the current record, because the current record is what the workflow is running on. I added a one line Run Script activity as the first activity following Begin, and this worked for me:
current.comments.setJournalEntry(current.request.special_instructions);
Just using current.comments = didn't work in this case, but I knew the special_instructions were getting picked up correctly by adding a logging line
workflow.info('SI ' + current.request.special_instructions);
then viewing the log via the Log tab on the Workflow Context Related Link on the RITM. The workflow runs on the sc_req_item table when the record is created, which is after the sc_request (REQ) record is created, so I've never experienced any trouble with retrieving or updating any fields on the RITM or REQ records right off the bat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 02:59 PM
Hi Brian,
Special instructions is a field on the sc_request table, so from the sc_req_item it would be more like:
current.comments = current.request.special_instructions;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 03:03 PM
Oh sweet so current.request allows me to access the parent request container? I couldn’t figure that out. I will try when I get home. Thanks?
Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 07:39 PM
OK I just tried this but it doesnt appear to be working. I'm adding this to the workflow advanced script area - where do see error messages in the processing? I'm googling around but havent found logs or error codes anywhere. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 11:02 PM
Here is the script I used to grab the special instructions collected at the cart - and dropped them in to the comments of the requested item. Then I was able to grab this and place the information on down stream tasks.
var gr= new GlideRecord("sc_req_item");
gr.get(current.sys_id);
gr.comments.setJournalEntry(current.request.special_instructions);
gr.update();
At first I was using the "Run Script" core activity in the workflow editor. For some reason "current" was returning blank text when using this script. Perhaps the requested item had not yet been created? I removed the "run script" activity and placed my script in the very first approval activity and it started working. Would love feedback from someone on why "current" would not work at the beginning of the workflow.