Transform OnBefore Script to compare source and target fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2017 12:24 PM
I am trying to create an OnBefore transform script to compare fields of the source and target. I have the following script but it is not working
if (source.active == target.active && source.u_ad_samaccountname != target.user_name){
target.u_userid = target.user_name;
target.update();
target.user_name='';
target.update();
}
1. Considering both active fields in source and target are equals to 'true', If source.u_ad_samaccountname is not equals to target.user_name then copy the value of target.user_name field then paste it in target.u_userid field.
2. After 1. is completed it then delete the value of target.user_name field.
Thank you.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2017 01:44 PM
Hi Jeffiral,
You cannot make user_name field blank. There must be a BR preventing you to make it blank.
You can try to make user_name blank manually.
Regards,
Sajan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2017 01:50 PM
Blank user_name is allowed. No business is set up preventing it. When user_name fields are emptied and the transform is ran, no error comes up. That is why before the transform happens, the sys_user table should be checked against the source table to identify same user record having different user_names in both tables, clear out the user_name in sys_user table if the user_name does not match of the source.chrismartinsajan0192
