How to map dot walk fields in transform map table? I tried the one provided in community but it didnt work.

sardarsa
Tera Expert

I am trying to populate the Phone number of the contacts in the Location table through transform map. I have an Excel sheet which has the phone no of the contacts.

 

I tried various transform maps scripts but the issue is with the dot walking since contact is a reference field from the sys user table.

I just want to update the records but when i do coalesce with contact, it updates but also inserts the duplicate record. and if i provide a transform map script on before

if(action=="insert");

ignore= true;

// This neither updates or inserts the record.

         

find_real_file.png

The screen shot of the Excel sheet is provided below:

find_real_file.png

2 REPLIES 2

Mark Stanger
Giga Sage

You can do this in a couple of different ways.

1)  Just create run a second transform (using the 'sys_user' table) against the import set.

2)  Use an 'On Complete' transform map script to query for the records and update them.

In my mind, this becomes a very simple task just by creating a second transform map to update the user information (phone number) after you've updated the location.

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Navigate to the field map "phone" and check "Use source script" flag to true with the source script as below. The below script is on assumption that email field is passed from the import set table.

 

answer='';

var gr = new GlideRecord('sys_user'); //query sys_user table

gr.addQuery('email', source.u_email); //Pass email field via import set table

gr.addNotNullQuery('phone');

gr.query();

if(gr.next())

{

answer = gr.phone;

}

 

-Pradeep Sharma