Monday, October 8, 2018

Retrieve all Customer Center roles

Here is a sample SuiteScript on how to retrieve the Customer Center Roles

Retrieve it via the getSelectOption() of the accessrole field.


Sample Script:

function getCustomerCenterRoles() {
      var customerRec = nlapiCreateRecord('customer');
      var rolesField = customerRec.getField('accessrole');
      var customerCenterRoles = rolesField.getSelectOptions();

      for(var i in customerCenterRoles) {

            nlapiLogExecution('DEBUG', 'Role Internal ID', customerCenterRoles[i].getId());

            nlapiLogExecution('DEBUG', 'Role Name', customerCenterRoles[i].getText());

      }

}

Debugger Results:

debug Role Name  Customer Center
debug Role Internal ID 14

No comments:

Post a Comment