- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:50 AM
Hello SN Community,
Other departments were merged to a different company but still works for us. Because of this they are all disabled in workday hence when the Workday integration schedule job runs, It will disabled those users in ServiceNow as well but they still need access to SNOW. I need help to make an exception. I created a onBefore transform script but it didn't work
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 12:38 AM
Hi @Danilo9 ,
I think you are on the right track and would recommend using an On Before Transform script as well. Only addition I would do to your logic is to make use of System Properties so that you do not have to add an OR condition every time within your script and in future you can maintain it easily rather than modifying the script every time.
Please use the On Before Transform script below:
Before using this please create a system property by navigating to "sys_properties.LIST" from application navigator and hit enter.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var getDept = gs.getProperty('Property Name');
if(action == 'update'){
if(source.u_department.indexOf(getDept)>-1){
ignore=true;
}
}
})(source, map, log, target);
In case if the above script does not work, then do check on below factors:
1. Source attribute used in above script is correct
2. Are there any other On After Transform script running after your On Before?
3. Are there any other Transform map or a custom feature in place which might be doing an update?
4. Put some logs in above transform script and then try to debug and share result to help you further.
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 12:38 AM
Hi @Danilo9 ,
I think you are on the right track and would recommend using an On Before Transform script as well. Only addition I would do to your logic is to make use of System Properties so that you do not have to add an OR condition every time within your script and in future you can maintain it easily rather than modifying the script every time.
Please use the On Before Transform script below:
Before using this please create a system property by navigating to "sys_properties.LIST" from application navigator and hit enter.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var getDept = gs.getProperty('Property Name');
if(action == 'update'){
if(source.u_department.indexOf(getDept)>-1){
ignore=true;
}
}
})(source, map, log, target);
In case if the above script does not work, then do check on below factors:
1. Source attribute used in above script is correct
2. Are there any other On After Transform script running after your On Before?
3. Are there any other Transform map or a custom feature in place which might be doing an update?
4. Put some logs in above transform script and then try to debug and share result to help you further.
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 12:19 PM
I will try the transform script tonight. I actually found a way using flow but I will give this a shot. Thank you for sharing this