Creating Multiple RITMs from one RITM in Workflow - Trouble setting variables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 08:53 PM
Working through an issue with a workflow where I have 1 RITM that has a list of access level requests in a list collector. I've assigned the list collector to a scratchpad array and I want to parse through that array to create a new RITM for each of the items in the array. Here's my runscript:
for (var i = 1; i < workflow.scratchpad.access_list.length; i++) {
gs.sleep(1000);
gs.log('Assignment Access Level ' +workflow.scratchpad.access_list[i].toString(),workflow.scratchpad.wf_name);
var ritm = new GlideRecord('sc_req_item');
ritm.newRecord();
ritm.request = current.request;
ritm.cat_item = current.cat_item;
ritm.due_date=current.due_date;
ritm.variables.role_name=current.variables.role_name;
ritm.variables.access_level = workflow.scratchpad.access_list[i];
//ritm.variables.access_level="b0d67332e4c9e40006d80e38f69704df";
ritm.setWorkflow(true);
ritm.insert();
gs.sleep(1000);
}
When the script runs, I get a log entry that reads:
Assignment Access Level b0d67332e4c9e40006d80e38f69704df
But when the new RITM is created, the access_level variable is blank. I was expecting the line:
ritm.variables.access_level = workflow.scratchpad.access_list[i].toString();
to properly set the access_level variable (a list collector) in the new RITM, but it is not.
Likewise, the line: ritm.variables.role_name = current.variables.role_name
is not properly setting the new RITM's role_name variable.
What am I missing here?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 09:51 PM
Hi
try setting the ritm.setWorkflow(true); to ritm.setWorkflow(false);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 09:56 PM
That does not seem to have an effect.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 09:57 PM
Hi
Are those variables global ticked?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 10:02 PM
They were not. I tried setting that property and it did not seem to help.