- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 10:38 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 10:51 AM
HI
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
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 10:51 AM
HI
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
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 10:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 08:04 PM
Hi,
should work fine.
Please share your field maps for this
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 12:54 AM
Can you share your existing field maps for this?
Ideally script is not required since you have made both the fields as Coalesce=true
So if both the values are found then it would updat
Even if 1 value is not present it would create
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader