REST - systemUserName is not resolving in Add Access JSON

IAM_99
Regular Contributor II
Regular Contributor II

Hi All,

We have rest connector - AddAccess JSON ,  passing systemUserName its not resolving.

from logs - ${user.systemUserName}

===================================

https://xxxxxxx/_host/users/abc1067 with httpParams - [login:${user.systemUserName}, groups:[items:[[label:Sales Administrator, variableName:salesAdministrator, type:Sales], [label:Sales Rep, variableName:salesRep, type:sales]]]]"

title":"login must start with a letter and only contain letters, numbers, underscores, dashes, and periods. It can contain a single @ character that cannot be at the end.","o:errorPath":"login"

if we use  ${user.systemUserName} --> user.systemUserName

======================================

pastResponse: [message:Unrecognized token 'user': was expecting ('true', 'false' or 'null')"

 

Add Access JSON

=======================

{
"call": [{
"name": "Entitlements",
"connection": "userAuth",
"url": "https://xxxxx/_host/users/${user.systemUserName}",
"httpMethod": "PATCH",
"httpParams": "${if(entitlementValue.entitlementID.toString().equals('CPQ_Admin')) {'{\"login\": \"${user.systemUserName}\",\"groups\": {\"items\":[{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"}]}}'} else if(entitlementValue.entitlementID.toString().equals('CPQ_Sales_User')) {'{\"login\": \"${user.systemUserName}\",\"groups\": {\"items\": [{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"},{ \"label\": \"Sales Rep\",\"variableName\": \"salesRep\",\"type\": \"sales\"}]}}'}else {} }",
"httpHeaders": {
"Authorization": "Basic XXXXXXXX",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [204, 200, 201]
}
}]
}

 

Can you let me know what i am doing wrong above ?

 

thanks,

suresh

2 REPLIES 2

sk
All-Star
All-Star

Try below for httpParams

"httpParams": "${if(entitlementValue.entitlementID.toString().equals('CPQ_Admin')) {'{\"login\": \"'+user.systemUserName+'\",\"groups\": {\"items\":[{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"}]}}'} else if(entitlementValue.entitlementID.toString().equals('CPQ_Sales_User')) {'{\"login\": \"'+user.systemUserName+'\",\"groups\": {\"items\": [{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"},{ \"label\": \"Sales Rep\",\"variableName\": \"salesRep\",\"type\": \"sales\"}]}}'}else {} }"

 


Regards,
Saathvik
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.

rushikeshvartak
All-Star
All-Star

Please try below JSON

{
  "call": [
    {
      "name": "Entitlements",
      "connection": "userAuth",
      "url": "https://xxxxx/_host/users/${user.systemUserName}",
      "httpMethod": "PATCH",
      "httpParams": "${if(entitlementValue.entitlementID.toString().equals('CPQ_Admin')) {'{\"login\": \"'+user.systemUserName+'\",\"groups\": {\"items\":[{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"}]}}'} else if(entitlementValue.entitlementID.toString().equals('CPQ_Sales_User')) {'{\"login\": \"'+user.systemUserName+'\",\"groups\": {\"items\": [{\"label\": \"Sales Administrator\",\"variableName\": \"salesAdministrator\",\"type\": \"Sales\"},{ \"label\": \"Sales Rep\",\"variableName\": \"salesRep\",\"type\": \"sales\"}]}}'}else {} }",
      "httpHeaders": {
        "Authorization": "Basic XXXXXXXX",
        "Content-Type": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          204,
          200,
          201
        ]
      }
    }
  ]
}

Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.