Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

import user data with password generated by script?

Pavan Nagidi
Tera Expert

Hello Experts,

I am trying to import user data using import sets from xls file.   I am using a script in the transform map variable mapping to generate password but that's not working. Could you please suggest, where I am doing wrong?

Script

var FN = source.u_first_name.toString();

var LN = source.u_last_name.toString();

var firstLength=FN.length;

var secondLength=LN.length;

target.user_password=FN.charAt(0).toUpperCase()+firstLength+FN.charAt(firstLength-1)+LN.charAt(0).toUpperCase()+secondLength+LN.charAt(secondLength-1);

Also attaching transform map screen shots FYR.

Thanks

Pavan

1 ACCEPTED SOLUTION

Guys,



The below script works for setting password using script while importing user profiles from import sets.



var FN = source.u_first_name.toString();


var LN = source.u_last_name.toString();


var firstLength=FN.length;


var secondLength=LN.length;


var pwd=FN.charAt(0).toUpperCase()+firstLength+FN.charAt(firstLength-1).toLowerCase()+LN.charAt(0).toUpperCase()+secondLength+LN.charAt(secondLength-1).toLowerCase();


answer=pwd;


Not sure why they are using answer!!! Below link will helpful.


http://www.snc-blog.com/2013/11/05/importing-users-with-password/


View solution in original post

6 REPLIES 6

Hi Tony,



Tried the same but that's not working.



Thanks


Pavan


Guys,



The below script works for setting password using script while importing user profiles from import sets.



var FN = source.u_first_name.toString();


var LN = source.u_last_name.toString();


var firstLength=FN.length;


var secondLength=LN.length;


var pwd=FN.charAt(0).toUpperCase()+firstLength+FN.charAt(firstLength-1).toLowerCase()+LN.charAt(0).toUpperCase()+secondLength+LN.charAt(secondLength-1).toLowerCase();


answer=pwd;


Not sure why they are using answer!!! Below link will helpful.


http://www.snc-blog.com/2013/11/05/importing-users-with-password/