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

@Vishwas 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

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

Community Alums
Not applicable

Hi,

Custom action

@Ankur BawiskarCan we dot walk in flow designer in inline script?

I am facing error in my flow "Cannot read property "u_internal_id" from null,Detail: Cannot read property "u_internal_id" from null"

return fd_data._1__get_catalog_variables.tel_data_plan_ref.u_internal_id;
 

Pranesh072
Mega Sage
Mega Sage

employee_name  is a reference variable type? 

Community Alums
Not applicable

No. String.