Getting Error: Cannot read property "variables" from null,Detail: Cannot read property "variables" from null

Community Alums
Not applicable

Hi @Ankur Bawiskar,

I am getting this error "Error: Cannot read property "variables" from null,Detail: Cannot read property "variables" from null" in flow designer while using flow designer for creating new user.

code:

var nameProvided = current.variables.employee_name;
var names = nameProvided.split(' ');
var firstName = names[0];
var lastName = names[1];
var userName = firstName.charAt(0)+lastName;
var isUnique = false;
var userNameUsed = '';
var email = '';


var gr0 = new GlideRecord('sys_user');
gr0.addQuery('username', userName);
gr0.query();
if (!gr0.next()) {
isUnique = true;
userNameUsed = userName;
email = firstName + '.' + lastName + '@XYZ.com';
}



var i=1;
while(isUnique == false)
{
var gr2 = new GlideRecord('sys_user');
gr2.addQuery('username', userName + i);
gr2.query();
if (!gr2.next()) {
isUnique = true;
userNameUsed = userName + i;
email = firstName + '.' + lastName + i+'@XYZ.com';
}
else
{
    var gr2 = new GlideRecord('sys_user');
    gr2.addQuery('username', userName + ++i);
    gr2.query();
    if (!gr2.next()) {
    isUnique = true;
    userNameUsed = userName + i;
    email = firstName + '.' + lastName + i+'@XYZ.com';   
}
}
}

 

 

1 ACCEPTED SOLUTION

Hi,

Since yours is a custom action refer this link which would give you an understanding of input, output etc

Custom Action in ServiceNow Flow Designer

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

21 REPLIES 21

Community Alums
Not applicable

find_real_file.png

Hi,

what is this action Update RITM Variable?

Is that a custom action created?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Community Alums
Not applicable

Hi,

Custom action, validating user name.

Hi,

So you must be having some input and output to this custom flow action

what input you are sending and what output you are getting?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

Since yours is a custom action refer this link which would give you an understanding of input, output etc

Custom Action in ServiceNow Flow Designer

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader