Transform Map Coalesce

beycos
Tera Contributor

Hello Everyone, 

 

I'm importing data from a JSON file using a Data Source and Transform Map. I have two fields set as coalesce: x and y. These two fields always have values in the incoming data, and are mapped correctly. what I need to achieve is If a record already exists with matching x and y , but the existing record has a value in the date deleted field 

So basically:

  • If Date deleted field is not empty, I want to bypass coalesce behavior and force insert.

  • If  date deleted is empty, normal coalesce behavior (update) is fine.

  • Any guidance or best practices are appreciated!

    Thanks in advance!

10 REPLIES 10

beycos
Tera Contributor

[
{
"Company": "SN",
"name": "X",
"dateDeleted": "2025-03-17",
"companyNumber": 123
},
{
"Company": "SN",
"name": "Y",
"dateDeleted": "",
"companyNumber": 456
}
]

I have a scheduled data import that runs daily using a Transform Map in ServiceNow.

  • The source field is: Company

  • The target field is: u_company

  • Coalesce is set to true on this field.  

    I want coalesce to work normally in all case. Except when the matching record in the target table has dateDeleted filled.In that case, I want to bypass coalesce and allow a new record (insert) even if Company already exists in the target table. However , Even when the 'date_deleted' field is empty, it continues to insert when I schedule it