Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Transform Map: Need coalesce behavior on computer id field when name as marked as coalesce

pavan_yadav
Tera Contributor

Hi Community,

I have a Transform Map where I have two unique fields:

  • Name
  • Computer ID

Currently, Name is configured as Coalesce = true in the Transform Map.

Computer ID is also an important unique field, but I cannot simply enable Coalesce on Computer ID because I have some specific scenarios that need different behavior.

I need the Transform Map to behave like this:

ScenarioNameComputer IDExpected
New recordABC123Create
Existing same Name + CIDABC123Update
Same Name + different CIDABC456Create new record
Update second recordABC456Update the 456 record,not 123 record.
Same Name + empty CID existsABCemptyUpdate the same-name record with empty CID

 

 

Current problem

Suppose two records already exist:

ABC/123
ABC/456

If the incoming record is (as already this record is present in the system so expected result is to update the same record)

ABC/456
 

but because Name is the only Coalesce field, the Transform Map selects the wrong record (ABC/123) and updating the first created record

I tried using an OnBefore Transform Script to find the correct record and change target.sys_id, but this does not change the actual record selected by the Transform Map.

 

Requirement

I want to keep Name as Coalesce = true, but add a coalesce-like/custom target selection behavior using Computer ID so that the Transform Map can select the correct target before the normal field mappings are applied.

I want to use the standard Transform Map update/insert process, not manually update.

Is there a supported ServiceNow Transform Map configuration or script/hook that can achieve this?




1 REPLY 1

Ankur Bawiskar
Tera Patron

@pavan_yadav 

approach you can try

-> Keep Name and Computer ID field maps, but set Coalesce = false on all of them.

-> Use an onBefore transform script to:

  • Query the target table using your custom logic (Name + Computer ID).

  • Use GlideRecord update if record found, if not found then do insert and set ignore=true always as you are updating/inserting via script only

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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