Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

RestAPI UpdateAcountJSON Unable to fetch account properties

Anu
Regular Contributor
Regular Contributor

Issues :For an update operation from Saviynt to application we have an requirement to read properties from Accounts customproperties. For which all the target values have been reconciled to Accounts Customproperties. However when we trigger the UpdateAccountJson the task is failing and unable to resolve the Account specific values. It works fine from postman and when we hardcode the account values in Json. Have tried both the syntax Account.accountproperties or userAccount.get('endpoint').accountsproperties. PFA attached JSON and let me know if any additional syntax to be followed to fetch the account properties for Update task to work.

For example :For testing purpose 'id' is hardcoded in hardcoded in Json hence doesn't appear in the error value whereas all other account read values have failed

Error: message":{"code":"MODIFYING_IMMUTABLE_FIELDS","message":"Account Type,Initials,Locale,Status cannot be missed or modified."},"statusCode":400,"description":null,"status":"Failed"}}

14 REPLIES 14

naveenss
All-Star
All-Star

Hi @Anu ,

when you're doing userAccount.get('endpointname')?.customproperty1. is your endpoint account is in "active" state and not in manually provisioned state?

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

naveenss
All-Star
All-Star

@Anu  also, there was an error in your JSON. I have modified it. Can you please try with the below JSON?

{
  "accountIdPath": "call1.message.userId",
  "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
  "responseColsToPropsMap": {},
  "call": [
    {
      "name": "call1",
      "connection": "userAuth",
      "url": "https://xxxxxxx/api/rest/v6/users/${account?.accountID}",
      "httpMethod": "PUT",
      "httpParams": "{\"email\":\"${user.email}\",\"accountType\":\"${account.accounttype}\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"initials\":\"${userAccount.get('endpointname').customproperty7}\",\"locale\":\"${account.customproperty6}\",\"status\":\"${account.customproperty11}\",\"company\":\"${user.entity}\",\"phone\":\"${user.phonenumber}\",\"title\":\"${user.title}\",\"id\":\"xxxxxxxx\"}",
      "httpHeaders": {
        "content-Type": "application/json",
        "Accept": "application/json",
        "Authorization": "${access_token}"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          200,
          201,
          204
        ]
      }
    }
  ]
}
Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Anu
Regular Contributor
Regular Contributor

@naveenss Thanks for the response.  we should fetch the account properties using Account.accountproperties or userAccount.get('endpoint').accountsproperties ?

Hi @Anu ,

Use userAccount.get('endpointname')?.customproperty to get account properties.


Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept As Solution to help other who may have a same problem. Give Kudos 🙂

${userAccount.get('EP-A').accountID} to get account properties of a different app/endpoinnt account for the same user.
${arsTasks.account.customproperty41}  or ${task?.accountKey?.customproperty41} to get cp41 of the same account for which json is getting invoked.

Anu
Regular Contributor
Regular Contributor

Hi Nimit, Updated the Json with syntax ${task?.accountKey?.customproperty41} to get account values as  its the same account for which the JSON is getting invoked. However still the update account task is failing and unable to resolve the account properties

@Anu , What error you are getting in the logs or task comment? 


Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept As Solution to help other who may have a same problem. Give Kudos 🙂

Anu
Regular Contributor
Regular Contributor

 Please find the error below

[quartzScheduler_Worker-16] ERROR rest.RestProvisioningService - Call response: {"code":"MODIFYING_IMMUTABLE_FIELDS","message":"Account Type,Initials,Locale,Status cannot be missed or modified."}
 [quartzScheduler_Worker-16] ERROR rest.RestProvisioningService - callResponseMap:

@Anu  from the error it says, you're modifying an attribute which is not supposed to be updated. Can you confirm if the above attributes "Account Type,Initials,Locale,Status" are allowed to be updated from postman?

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Anu
Regular Contributor
Regular Contributor

@naveenss As stated in the Problem statement we are able to update from PostMan and also able to update when we hardcode the account values in Json. Usecase: when we want to update the firstname of the User from Saviynt ,target API expects actual target values(Account Type,Initials,Locale,Status) also to be passed for the user .Hence using the reconciliation we have stored the Target user details in account custom properties. So when an update task trigger for user firstname change ,its expected that we also read/pass user values from account properties for these columns Account Type, Initials, Locale, Status. If we send all the column values from user profile it works however when we try to pass from account properties its failing

nimitdave
Saviynt Employee
Saviynt Employee

@Anu : check for logs as below:

2023-07-26 11:59:06,700 [quartzScheduler_Worker-15] DEBUG rest.RestProvisioningService - Inside pullObjectsByRest
2023-07-26 11:59:06,700 [quartzScheduler_Worker-15] DEBUG rest.RestUtilService - Got showLogs = true
2023-07-26 11:59:06,701 [quartzScheduler_Worker-15] DEBUG rest.RestProvisioningService - Calling Webservice Url - http://<domainname>/ECM/api/v5/updateAccount with httpParams - [securitysystem:SolveSpace, endpoint:SolveSpace, name:EMP0013, customproperty3:UAT, 460361:desc, status:1]

Looks like one of the expression is not get evaluated and because of which whole json is not getting evaluated.

Also , I assume that the account is already having the custom properties and account type values set before the update account request submission.

Anu
Regular Contributor
Regular Contributor

@nimitdave Thanks for the response. All the account custom properties have been set and validated . Showlog is already set to true still unable to locate the Updateaccount specific trace as you mentioned in the logs. 

iam01
Regular Contributor
Regular Contributor

@Anu  is this issue resolved?

Anu
Regular Contributor
Regular Contributor

This issue was resolved.we where able to get the account details during Update using \"accountType\":\"${account.accounttype}\"