- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 12:16 AM
Hey everyone,
I have a List-Field on the sys_user_group records which is a list of users.
I need to update this field via Flow to add a user while keeping those who are already in there and deleting one user while keeping the rest in.
I tried using the "Update Record"-Action but when adding a user to the list it completely overwrites the content and only adds that one user to it. When it comes to deleting only one specific user, I haven't found a way to do that in a flow.
Has anyone experienced that issue?
Thank you in advance,
Konstantinos
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 01:16 AM
I have created a custom List field called Users in Group table in my PDI and I created test flow for POC.
The first action in the flow is Look Up record which returns a random user record and the second Action is a Look Up record which returns the Service Desk group record.
The third action is Update Record which updates the Users field with the user returned by the first action. See the script and screen shots below.
var current_users = fd_data._2__look_up_record.record.u_users + '';
var new_user = fd_data._1__look_up_record.record.sys_id + '';
var updated_users = current_users + ',' + new_user;
return updated_users;
And I created another flow with same steps, but this time it deletes the user from the list without effecting others.
var current_users = fd_data._2__look_up_record.record.u_users + '';
var del_user = fd_data._1__look_up_record.record.sys_id + '';
var updated_users = current_users.replace(del_user+',', "").replace(del_user, "");
return updated_users;
Service Desk Group before running any flow:
Service Desk Group after running add flow:
Service Desk Group after running delete flow:
You can use the same logic in your case too.
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 12:34 AM
The List field will contain sys_id of records separated by commas. If you wat to update, get the existing value and append the sys_id of the user and then set the updated value back to the field.
If you want to delete, remove the sys_id of user from the existing value and update the field with modified string.
Need more help! Let me know how you are getting the user to be added or deleted (Screenshots would be more helpful).
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 12:44 AM
Hey Anvesh,
Is there a way to add and delete said specific user sys_Id without losing the lists content via Flow?
I don't have any kind of solution implemented to attach screenshots.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 01:16 AM
I have created a custom List field called Users in Group table in my PDI and I created test flow for POC.
The first action in the flow is Look Up record which returns a random user record and the second Action is a Look Up record which returns the Service Desk group record.
The third action is Update Record which updates the Users field with the user returned by the first action. See the script and screen shots below.
var current_users = fd_data._2__look_up_record.record.u_users + '';
var new_user = fd_data._1__look_up_record.record.sys_id + '';
var updated_users = current_users + ',' + new_user;
return updated_users;
And I created another flow with same steps, but this time it deletes the user from the list without effecting others.
var current_users = fd_data._2__look_up_record.record.u_users + '';
var del_user = fd_data._1__look_up_record.record.sys_id + '';
var updated_users = current_users.replace(del_user+',', "").replace(del_user, "");
return updated_users;
Service Desk Group before running any flow:
Service Desk Group after running add flow:
Service Desk Group after running delete flow:
You can use the same logic in your case too.
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh