The CreatorCon Call for Content is officially open! Get started here.

We are getting data from LDAP to ServiceNow instance.

niveditakumari
Mega Sage

Hi, 

 

We are getting data from LDAP to ServiceNow instance. When one record is getting deleted in LDAP(staging table)  then that record should be inactive in ServiceNow instance. 

We are getting data like UserID, Name, email, location from LDAP to ServiceNow. 

Can anyone please help me to achieve that. 

 

Regards, 

Nivedita 

 

 

7 REPLIES 7

Hi @Community Alums, 

 

We need to check first record is created through LDAP or manually that we can check with field source which is available in 'sys_user' table if source field is not empty then record is created through LDAP and then we get all record which gets created through LDAP after that we can check user record which is available in 'sys_user' table but not in LDAP it mean record get deleted in LDAP and we need to made that record inactive in 'sys_user' table. 

Can you please help me to achieve that. 

 

Regards, 

Nivedita 

 

 

niveditakumari
Mega Sage

Hi, 

 

I have to check user which source is not empty and active in 'sys_user' table using transform script. I have never written transform script. 

Can anyone please help me to print all user which source is not empty and that is active in 'sys_user' table and source is field in 'sys_user' table. 

code : 

var c = 0;
    var gr = new GlideRecord('sys_user');
    gr.addQuery(source != ''|| active == 'true');
    gr.query();
    while(gr.next()) {

        gs.print('active user is' + gr.source);  
        c++;
    }
    gs.print('count is' + c); 
 
It is printing all user but as per code it should print only thast user which satisfy above condition. 
 
Can anyone please help me to achieve that. 
 
Regards, 
Nivedita 
 
 

niveditakumari
Mega Sage

Hi @Ankur Bawiskar, @Harish KM,

 

Can you please help me with my OnComplete transform script. 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    // Add your code here
    var c = 0;
    var gr = new GlideRecord('sys_user');
    gr.addQuery(source.u_source != ''|| active == 'true');
    gr.query();
    while(gr.next()) {

        gs.print('active user is' + gr.source);  
        c++;
    }
    gs.print('count is' + c);

})(source, map, log, target); 
 
I need to print all user which source field is not empty and active is true in user table but it is printing all user record from user table. 
Can you please correct my code. 
 
Regards, 
Nivedita