clear the sys_id in GlideList field

Chaitanya Chowd
Kilo Expert

Hi All,

Consider the below scenario and help me in solving it

I have created a "List" type field in Incident form and it is referenced to "User" table.

find_real_file.png

I added a user to the "List" type field in Incident form. After that. I deleted the same user in "User" table . Now i am able to see a sys_id in the "List" type field in Incident form.

find_real_file.png

So help me like, if i delete the a user in "User" table, it should also delete its value in the referenced fields("List" type field in Incident form) and it should not display any sys_id.

9 REPLIES 9

Tim Deniston
Mega Sage
Mega Sage

There is a field on the dictionary called "Reference cascade rule." You would select "Clear: Clears the references (default)."


Unfortunately Cascade Rule do not work for GlideList fields, only for Reference fields, although the Cascade Rule selection is displayed for GlideList fields.



I have created an Incident for this last summer and Customer Support told me that it is expected behavior, but they have created a Feature Request which is currently in status "Under Consideration".


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dcn,



For this you need to have before delete business rule on user table and do following:


1) query incident table and search records which have this current sys_id in the glide list field.


2) if record found then take all the sys_ids from the glide list and remove this deleted record sys_id and update the incident record once again



Example:


INC1 has User1, User2, User3 in glide list


if user 2 is getting deleted


in the query you will get this INC1 since the glide list column contains user 2


get the value remove user 2 from that and populate only User 1 and User 3 back in glide list field.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,



I have a doubt, how to get the details of user(whose record is being deleted) in business rule.



Eg: Assume User1 is being deleted and we need to query to get the incidents with User1 in glideList. How we will get the details User1 in Business rule



Kindly provide a example code snippet.