- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 07:42 AM
Hello,
I have created onBefore Transform Script to update target fields in certain conditions for example :
// If type is "A" & discovery is "B" --> Update only the target field discovery
if (source.u_type == "A" && target.discovery == "B") {
target.discovery = "A";
}
When I test, I find that in the target record, all fields are updated but I want only the "discovery" field to be updated.
So how can I ignore the update of the other fields in the Field Maps section and only update one field "discovery" ?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 08:54 AM
Hi,
There is only one way to achieve this, you will have to update target record in onBefore script and mark ignore as true.
Please try below script,
if (source.u_type == "A" && target.discovery == "B") {
target.discovery = "A";
target.update();
ignore=true;
}
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 08:54 AM
Hi,
There is only one way to achieve this, you will have to update target record in onBefore script and mark ignore as true.
Please try below script,
if (source.u_type == "A" && target.discovery == "B") {
target.discovery = "A";
target.update();
ignore=true;
}
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2022 01:28 AM
Hello,
Thank you it worked.
Have a nice day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:48 AM
Hi @Abhijit4 ,
Could you please give your inputs on it. I tried your code too in my use case to update only one field, but it was not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 05:08 AM
Hey @Sironi ,
Your link is not working for me, looks like you have deleted your question. Let me know if you need any help.
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 03:07 AM
Hello @Abhijit4 ,
i have a scenario where i have to update all other fields(including 2 source scripts) except one field via on before transform script on some conditions.
Can it be done ?
Thanks & regards,
Subhasis