Click HERE to see how Saviynt Intelligence is transforming the industry. |
02/27/2023 02:03 AM - edited 02/27/2023 03:18 AM
Dear all,
I am trying to create account on Zoho Projects application where a user is selecting Rolename in access request Dynamic attribute.
Now based on the rolename selected in dynamic attribute I need to send role id to the REST API.
I tried creating user without any dynamic attribute and all role id and email information as fixed value in createAccountJSON and it worked fine.. then I modified my createAccountJSON to adjust based on value selected in dynamic attribute and request is failing.
Kindly go through them and let me know where I am doing wrong.
Thanks
Working JSON:
{
"accountIdPath":"call1.message.users.zpuid",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://projectsapi.zoho.in/restapi/portal/60019805102/users/ ?email=pawan.kumar@test.com&roleid=155720000000031037&profileid=155720000000029551 ",
"httpMethod":"POST",
"httpHeaders":{
"Authorization":"${access_token}"
},
"unsuccessResponses":{
"error.message":"Operation Failed",
"error.message":"General Error"
}
}
]
}
JSON with if else and Dynamic attribute : ERROR
{
"accountIdPath":"call1.message.users.zpuid",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://projectsapi.zoho.in/restapi/portal/60019805102/users/?email=${user.email}&roleid=${if(requestAccessAttributes.get('RoleName')=='Test'){'155720000000033008'} else if(requestAccessAttributes.get('RoleName')=='Test1'){'155720000000033009'} else{'155720000000028005'}}&profileid=155720000000029551",
"httpMethod":"POST",
"httpHeaders":{
"Authorization":"${access_token}"
},
"unsuccessResponses":{
"error.message":"Operation Failed",
"error.message":"General Error"
}
}
]
}
Solved! Go to Solution.
02/27/2023 02:26 AM
Instead of if else , use this
${requestAccessAttributes.get('RoleName') == 'Test' ? '155720000000033008 ' : '155720000000028005'}
02/27/2023 03:16 AM
Hi Darshan,
We have multiple if elseif else conditions so cannot use your suggestion.. I will update my question accordingly.
Thanks
02/27/2023 03:31 AM
The above if else should also work generally, What is the error you are getting or you are getting null values, Also try once with the above condition which i have given and see if you are getting the values correctly there just to see there is no issue with DA values
02/27/2023 03:39 AM - edited 02/27/2023 03:59 AM
Hi Darshan,
I tried the below json and it also failed for me.. Not able to get the log details as logs are not loading in our environment.
{
"accountIdPath":"call1.message.users.zpuid",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://projectsapi.zoho.in/restapi/portal/60019805102/users/?email=${user.email}&roleid=${requestAccessAttributes.get('RoleName ') == 'Test' ? '155720000000033008' : '155720000000028005'}&profileid=155720000000029551",
"httpMethod":"POST",
"httpHeaders":{
"Authorization":"${access_token}"
},
"unsuccessResponses":{
"error.message":"Operation Failed",
"error.message":"General Error"
}
}
]
}
Thanks
02/27/2023 08:45 PM
If the logs are not loading , i would prefer you to raise a ticket in FD and get that working so that it is easy to check in logs if the values are populating or not.
Also as @adriencosson said , once logs are working in the config json you can put showlogs=true so that you can troubleshoot where you are going wrong
02/27/2023 01:51 PM
Hello,
To help you troubleshoot the issue, you can set the below Json in ConfigJSON parameter of your connector :
{"showLogs":true}
This way you would get the appropriate logs.
Also, you might give a try with the following naming convention : reqAttrs that is also available to get Dynamic Attributes in REST Connector.
02/27/2023 10:13 PM - edited 02/27/2023 10:14 PM
Dears,
I was creating the json correctly but there was some issue in my roleid thats why account creation was failing..
Below is the working json.
{
"accountIdPath":"call1.message.users.zpuid",
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://projectsapi.zoho.in/restapi/portal/60019805102/users/?email=${user.email}&roleid=${if(requestAccessAttributes.get('RoleName')=='Test'){'155720000000031037 '} else{'155720000000028005'}}&profileid=155720000000029551",
"httpMethod":"POST",
"httpHeaders":{
"Authorization":"${access_token}"
},
"unsuccessResponses":{
"error.message":"Operation Failed",
"error.message":"General Error"
}
}
]
}
Thanks
02/27/2023 10:21 PM
@gauravchandok Perfect, As the logic was correct only issue would have been DA value not populating or parameter passing. Good to know that its working now.