- 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:28 AM - edited 11-28-2023 01:32 AM
Can you try this:
target.u_firstname = "XYZ";
Also if your mapping is straight forward with the source, you can directly do the mapping like below instead fof write the scripting
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:09 AM
i want my target table field name is u_firstName , and in my excel sheet field name is FirstName there are four records which are insert like in all four fields FirstName are diffrent when i do all process with this script means all four records FirstName will same which i set in transform map script , target.u_firstname = 'xyz ';
in all four records xyz will come in target fields if yes then how
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 01:30 AM
Hi @dheeru_1994
If you have this value in source, you can simply do the field mapping instead of writing script. Let me know if you can't use field map and you should only use script.
Please check the following documentation for help on field mapping.
https://docs.servicenow.com/csh?topicname=t_CreatingAFieldMap.html&version=latest
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 01:44 AM
@dheeru_1994 Instead of using On After script, you can add this field in field map and use the 'Use source script' option as below. And use script as return "xyz";