- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 01:22 AM
HII All i have requirement ,my requirement is i am using transform map script to update or set new value like my target field name is u_firstname for that on after i am doing
target.setValue('u_firstname','xyz');
but after completing transformation in my target table nothing is comming even though source field name and target field name are correct any help
Note:- i am very weak in transform script please provide me stuff with code like how to use ,map, source , target
thanks everyone
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:29 AM - edited 11-28-2023 04:29 AM
In field map add target field you want to set. And check the checkbox for script(field : Use Source Script). Add below code.
return "xyz";
It will set the target field value you want to set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 01:49 AM
HI @dheeru_1994 ,
I trust you are doing great.
ere's a basic example of how you can set the value in the onAfter
script. This script assumes that you're trying to set the u_firstname
field in the target table based on some condition or value from the source table:
(function runTransformScript(source, map, log, target /* GlideRecord */) {
// Example condition - modify as needed
if (source.u_some_field == 'someCondition') {
target.u_firstname = 'xyz'; // Set the target field value
}
target.update(); // Important to save the changes
})();
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 03:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:13 AM
@dheeru_1994 This script will not work. If you want without any condition.
As I said above you can try with this: add target field in field map and use script there as return "xyz";
It will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:18 AM
can you write code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:29 AM - edited 11-28-2023 04:29 AM
In field map add target field you want to set. And check the checkbox for script(field : Use Source Script). Add below code.
return "xyz";
It will set the target field value you want to set.