- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 06:43 AM
Hello All,
Hope everyone is doing well and good!!!
I have a field called tier1 (check box:true/false filed smiliar to vip field )in the sys_user form ,Everytime i load the data of users to the user table using transform maps all the existing users whose tier1 values are true need to be made false and the loaded data of users will have the tier1 value as true.
the data will be provided every month and whenever i upload the data the old users or the users whose tier1 value is true should be stripped to false and only the data in excel users will have true .
How can i achieve this using transform maps and transform scripts
Thank you!!! in advance
Kumar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:18 AM
Hi,
Please try with below onStart script,
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var userGr=new GlideRecord('sys_user');
userGr.addQuery('tier1',true);
while(userGr.next())
{
userGr.tier1=false;
userGr.update();
}
})(source, map, log, target);
for new user if you don't have tier1 field in source table use onBefore Script to make it true.
Please mark if that help you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:09 AM
Hi ,
You can use onStart transform script and glide the previous user to update the tier1 to false.And for new record you can set it to true.
Please mark if that helps you!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:18 AM
Hi,
Please try with below onStart script,
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var userGr=new GlideRecord('sys_user');
userGr.addQuery('tier1',true);
while(userGr.next())
{
userGr.tier1=false;
userGr.update();
}
})(source, map, log, target);
for new user if you don't have tier1 field in source table use onBefore Script to make it true.
Please mark if that help you!!