- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 04:05 AM - edited 11-14-2024 04:06 AM
Hi Team
have requirement to check unique name after that group and after that category then update record otherwise ignore
using transform map
please advice
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 07:30 AM
Hi @vamshi2 ,
No, check the logic, if name execute and found record then it wont check other two.
Execute the code and check, it will work.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 04:31 AM
Hi @vamshi2
You can do below.
1. in script tag set ignore true if action is insert.
if (action == 'insert' ){
ignore = true;
}
2. create once filed map to with sys_id and write code to check based on three fields.
code:
answer = (function transformEntry(source) {
var sys_id = "";
var gr = new GlideRecord('sys_user');
gr.addQuery('name', cource.u_name);
gr.query();
if (gr.next()) {
sys_id = gr.sys_id;
} else {
gr = new GlideRecord('sys_user');
gr.addQuery('group', cource.u_group);
gr.query();
if (gr.next()) {
sys_id = gr.sys_id;
} else {
gr = new GlideRecord('sys_user');
gr.addQuery('category', cource.u_category);
gr.query();
if (gr.next()) {
sys_id = gr.sys_id;
}
}
}
return sys_id; // return the value to be put into the target field
})(source);
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 07:17 AM
Thank you so much for response but here I need to check three fields one after other
First need to check name then need to check group and then need to check category then I need to update but here in above code it is any one of the fields
Please advise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 07:30 AM
Hi @vamshi2 ,
No, check the logic, if name execute and found record then it wont check other two.
Execute the code and check, it will work.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------