TypeError: Cannot call method "AddMember" of null
For some reason, my service stopped working. It used to work, but I think after I duplicated the mashup and started using the duplicate mashup, it stopped working. When I run the service by itself in the helper Thing, it works. I get the error when I run it from the mashup. The bindings are still correct and there seems to be no issue with the service and the inputs to the service. The input for the user group name comes from the value field of a list. When I bind the service that populates the list to a grid, the value field is there so it is not "null". Please see the code below. It seems that for some reason, the AddMember method is not getting or cannot get the name of the user group entity.
The error message I get is as follows:
"User Creation Error: TypeError: Cannot call method "AddMember" of null"
I added try/catch since it created a ghost user every time I ran the service from the mashup.
********************************************
var params = {
password: Password /* STRING */,
name: UserName /* STRING */,
description: undefined /* STRING */,
tags: undefined /* TAGS */
};
try {
// no return
Resources["EntityServices"].CreateUser(params);
Users[UserName].firstName=FirstName;
Users[UserName].lastName=LastName;
Users[UserName].emailAddress=EmailAddress;
Users[UserName].title=Title;
Users[UserName].workPhone=PhoneNumber;
var newUserParams = {
member: UserName /* STRING */,
type: "User" /* STRING */
};
// no return
Groups[UserRoleGroup].AddMember(newUserParams);
} catch(err) {
logger.debug("User Creation Error: " +err);
}
********************************************
"UserRoleGroup" contains the name of the user group entity that the user needs to be added to. UserRoleGroup is a string.
I am on Thingworx 8.4.1

