- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 11:19 PM
I have writtern script without starting run transformscript function but used source and target objects will it going to work for that matter whatever may be the type of transform script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 01:39 AM
Hi @KM SN,
I can confirm (as tested and verified on an instance), you can indeed leverage the target.field_name (in your case (target.user_name) in an onAfter Transform Script.
You will need to wrap them within the function braces as shown below, but it can simply log the target.user_name as desired.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 01:13 AM - edited 07-03-2024 01:14 AM
Hi @KM SN,
To answer your question directly: Yes - both 'source' and 'target' objects are available.
Providing a little more information and context, you'll notice in the function parameters some keywords/objects available for each Script Type of which source and target are declared.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
})(source, map, log, target);
SN Docs link to Transform Map Scripts and Variables: https://docs.servicenow.com/bundle/washingtondc-integrate-applications/page/script/server-scripting/...
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 01:22 AM
Hi Robbie, Thanks for reply
You mistaken me, the actual query is does target and source parameters will work if i use them in the script without the function as indicated in the screenshot of line one.
Thanks
Mani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 01:39 AM
Hi @KM SN,
I can confirm (as tested and verified on an instance), you can indeed leverage the target.field_name (in your case (target.user_name) in an onAfter Transform Script.
You will need to wrap them within the function braces as shown below, but it can simply log the target.user_name as desired.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 01:47 AM
Thanks for reply.
Regards
Mani