Update a coelesce field in transform map

shilpa26
Tera Contributor

Hi,

I have a transform map which is updating groups table. I have a requirement where based on the condition I need to update the group name. But I am using group name as a coelesce field. Whenever I try to update the group name it gives an error : unable to resolve target field.

I tried to update the coelesce field using oncomplete transform script even then it's not working. Is there a way to update the coelesce field without effecting other field mappings?

 

Thanks in Advance.

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @shilpa26 

 

Technically, the group name is not the right coalesce, as it is a string, it might be silly but in some writing writing grid p name we add space or . by mistake and this code will fail. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Sandeep Rajput
Tera Patron
Tera Patron

@shilpa26 Updating a coalesce field (in this case, the group name) in a Transform Map can be tricky because it's used to match existing records. If you're using Group Name as the coalesce field and trying to update it, you’ll run into issues because ServiceNow relies on it to determine whether to insert or update a record.

 

If you must coalesce on Group Name but still need to update it, do this:

1.Create a Temporary Field: Add a new field in the import set table (e.g., u_temp_group_name).
2.Map the incoming group name to this field instead of directly mapping it to sys_user_group.name.
3.Use an onAfter Transform Script to Update the Group Name

Ankur Bawiskar
Tera Patron
Tera Patron

@shilpa26 

updating a coalesce field is not a good practice because that's the primary identifier for the system to determine if insert/update happens.

what's your business requirement?

If the coalesce field is not found let it create a fresh record

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@shilpa26 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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