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
Mega 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
}

 

View solution in original post

9 REPLIES 9

Jaspal Singh
Mega Patron

Hi Naneen,

In the script field of the Table Transform map form you can try adding

if(target.u_caller_id.active==false ||target.u_caller_id.active=='false')

{

ignore=true;

}

is it possible to get the error message sent to rest api back that the user is inactive?

SanjivMeher
Mega 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
}

 

is it possible to get the error message sent to rest api back that the user is inactive?