Transform map script ignore particular field update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017 11:04 AM
Hi All,
We have LDAP Setup and a transform map configured to it. We have a 'onBefore' transform script.
if(action == "update") {
if(target.u_code == "100" || target.u_code == "1000") {
ignore = true;
}
}
Because of the above script, the user records with code as '100' or '1000' are ignored from updating. This results in not updating the 'source' field for those users. How to update only source field without updating other fields??
Note: The main purpose of the onBefore script is we don't want to update the 'email' and 'user_name' fields of the users with code as '100' or '1000'.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017 11:37 AM
Hi Sachin
In the transform script, write below code
- if(action == "update") {
- if(target.u_code == "100" || target.u_code == "1000") {
- ignore = true;
- }
- else{
- target.email = source.u_email ; //Check the correct field name form the source
- target.user_name = source.u_user_name ;//Check the correct field name from source
- }
- }
Also, Make sure to remove the mapping of the email and username in field mappings of the transform script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2017 09:53 AM
Hi Harsh,
I don't think the above script will work for me. I think it works fine for "update", but if I remove field map of 'email' and 'username' fields then those fields wouldn't update during "insert" action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2017 06:28 PM
Hi Sachin
You do not need to check for the action and you can directly put the if condition to check code 100 & 1000.In this case for all insert and update action, script will check the code . If result satisfy then field will be mapped otherwise it will be ignored.
- if(target.u_code == "100" || target.u_code == "1000")
- ignore = true;
- }
- else{
- target.email = source.u_email ; //Check the correct field name form the source
- target.user_name = source.u_user_name ;//Check the correct field name from source
- }