Transform script validate User Active True or False

Ram050670
Tera Guru

Hi All, i am trying to find a solution for validate User ID active or not in Transform.

can someone help me if we can validate that using run script on the transform.

 

Naneen_0-1697830277701.pngNaneen_1-1697830328180.png

 

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

You can create a onBefore Transform script and create a query to check if the called id is valid. If not, if you want to ignore, you can set ignore=true. Below is an example.

 

var user = new GlideRecord('sys_user');
user.addQuery('user_name',source.u_caller_id);
user.query();

if (user.next() && user.active!='true')
{
ignore=true
}

 


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

9 REPLIES 9

I dont think, unless you are using scripted rest api.

In the scripted rest api, you can validate the data even before transforming it.


Please mark this response as correct or helpful if it assisted you with your question.

can you help me write Scripted rest api?

 

Below link is a good starting point

https://www.servicenow.com/community/itsm-articles/scripted-rest-api-in-servicenow-inbound-integrati...

 


Please mark this response as correct or helpful if it assisted you with your question.

Badal Khojare
Mega Sage
Mega Sage

Hi @Ram050670 ,

Also check this: https://www.servicenow.com/community/itsm-forum/transform-script-to-show-active-inactive-users/m-p/7...

 

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023

Thanks for your response, but i am trying to look for user active status when i use rest api in order to avoid create INC for inactive user and i want to get error info mesg on that response.