How to update record based on multiple coalesce field

shaik_irfan
Tera Guru

Hi,

 

I have a import set and transform map where i am importing user record based on user id and email id i need to update record when both field values are matched and i made both fields as colease to true but still it is creating a new record.

 

Is there a way we can acheive this?

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

HI @shaik.irfan 

What you can do here is write a On Before Transform Script and use the script shared below:

var getSourceUserID = source.FieldName.toString();//Replace "FieldName" with source User ID;
var getSourceemail = source.FieldName.toString();//Replace "FieldName" with source Email;

var gr = new GlideRecord('sys_user');
gr.addQuery('user_name',getSourceUserID);
gr.addQuery('email',getSourceemail);
gr.query();
if(gr.next()){
....do the update here for the fields you want as for example below:
gr.name = source.FieldName;
gr.update();
}else{
ignore=true;
}

This should work for you.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

6 REPLIES 6

@shaik.irfan 

Any update on this?

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

shloke04
Kilo Patron

Hi @shaik.irfan 

If you have a follow up query then do let me know, else please mark the answer as correct and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke