How to add list values in a Flow Designer variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 01:13 AM
Hello All,
In flow designer i created a set a flow variable, Please check the attached screenshot.
Flow variable script:
var gr = new GlideRecord("sys_user_delegate");
We are setting the selected delegate "end time" as current time. so that the selected delegation will end immediately with current time, which is working.
Can someone please help me on this so that it will work for multi selected delegates cancellation.
@Ankur Bawiskar @Community Alums @Sid_Takali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:06 AM
Hello @sattar3 ,
Can you attach the updated script for set Flow variable? then anyone can able to answer
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:31 AM
@RAMANA MURTHY G Thanks for the reply.
I used the below script for list collector variable type.
var delegateSysIds = [];
var gr = new GlideRecord("sys_user_delegate");
// Assuming fd_data.1_get_catalog_variables.your_delegate is an array of sys_ids
var selectedDelegates = fd_data.1_get_catalog_variables.u_delegate;
for (var i = 0; i < selectedDelegates.length; i++) {
gr.addQuery('sys_id', selectedDelegates[i]);
gr.query();
if (gr.next()) {
delegateSysIds.push(gr.sys_id.toString());
}
}
// Return the list of sys_ids
return delegateSysIds;
I got the attached error "Value of field record is not a GlideRecord".
Thanks,
Sattar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:49 AM
Hello @sattar3 ,
in this case you have to create Update Record action in for each flow logic
Thank you
G Ramana Murthy
ServiceNow Developer