and more in a single search tool across platforms. Read the announcement here. |
02/23/2024 03:21 AM
Hi Everyone,
Issue: Guest/external users are creating in Saviynt through invitation form. Post invitation acceptance, Guest user's profiles will be creating in saviynt. These guest users have country name.
For one application, when we are trying creating new account for these guest users, but application API will accept only countrycode(like IN,AU,US..) and it will not accept the country name for country attribute in target.
Is there any way to pass country code in create account JSON based on guest user's country name.?
Ex: If guest user have India as country in Saviynt then we need to push country code "IN" in create account JSON during task execution.
02/23/2024 03:50 AM
Hi @Rajesh_IAM
Yes. This is possible. you can use if/else conditions in your create Account JSON.
02/23/2024 03:53 AM
@naveenss Thank you for your response.
Can you give me sample syntax.? But guest user's profile have country name then how is it possible to generate country code during create account task execution.?
02/23/2024 04:02 AM
@Rajesh_IAM I'm sharing the sample JSON with if/else for country. Please make modifications to your JSON based on the requirement.
{
"accountIdPath": "${(user.customproperty1=='Guest')?'call1.message.invitedUser.id': 'call1.message.id'}",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"responseColsToPropsMap": {
"customproperty31": "${(user.customproperty1=='Guest')?'call1.message.inviteRedeemUrl~#~char': ''}",
"customproperty1": "${(user.customproperty1=='Guest')?'call1.message.invitedUserType~#~char': ''}",
"displayName": "${(user.customproperty1=='Guest')?'call1.message.invitedUserDisplayName~#~char': 'call1.message.displayName~#~char'}",
"name": "${(user.customproperty1=='Guest')?'call2.message.userPrincipalName~#~char': 'call1.message.userPrincipalName~#~char'}"
},
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "${(user.customproperty1=='Guest')?'https://graph.microsoft.com/v1.0/invitations':'https://graph.microsoft.com/v1.0/users'}",
"httpMethod": "${(user.customproperty1=='Guest')?'POST':'POST'}",
"httpParams": "${if(user.customproperty1.equals('Guest')){return '{\"invitedUserEmailAddress\":\"' + user.email + '\",\"invitedUserDisplayName\":\"' + user.firstname + '\", \"inviteRedirectUrl\":\"https://portal.azure.com\", \"invitedUserType\": \"Guest\", \"sendInvitationMessage\":\"true\",\"country\":\"'+if(user?.country=='India'){return 'IN'}+'\"}';} else if(user.customproperty1.equals('Work')) {return '{\"accountEnabled\": \"true\", \"displayName\": \"' + user.firstname + '\", \"mailNickname\": \"' + user.firstname + '\", \"passwordProfile\": { \"password\": \"Passw0rd\"}, \"UsageLocation\": \"US\",\"userPrincipalName\": \"' + user.username + '\", \"extension_924eb70c1cb54dc9b9b00ad99df04b38_TimeZone\": \"' + user.customproperty15 + '\", \"extension_924eb70c1cb54dc9b9b00ad99df04b38_Profile\":\"' + user.customproperty16 + '\"}';}else {return '{\"displayName\": \"' + user.firstname + '\",\"identities\": [{\"signInType\": \"' + user.username + '\",\"issuer\": \"saviyntliveb2c.onmicrosoft.com\",\"issuerAssignedId\": \"' + user.username + '\"},{\"signInType\": \"emailAddress\",\"issuer\": \"saviyntliveb2c.onmicrosoft.com\",\"issuerAssignedId\": \"' + user.email + '\"}],\"passwordProfile\" : {\"password\": \"Saviynt@12345\",\"forceChangePasswordNextSignIn\": false},\"passwordPolicies\":\"DisablePasswordExpiration\", \"extension_924eb70c1cb54dc9b9b00ad99df04b38_TimeZone\": \"' + user.customproperty15 + '\", \"extension_924eb70c1cb54dc9b9b00ad99df04b38_Profile\":\"' + user.customproperty16 + '\"}';}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
},
"unsuccessResponses": {
"error.code": [
"Request_BadRequest",
"Authentication_MissingOrMalformed",
"Request_ResourceNotFound",
"Authorization_RequestDenied",
"Authentication_Unauthorized",
"BadRequest"
]
}
},
{
"name": "call2",
"connection": "userAuth",
"url": "${(user.customproperty1=='Guest')?'https://graph.microsoft.com/v1.0/users/${response.call1.message.invitedUser.id}': 'https://graph.microsoft.com/v1.0/users'}",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
},
"unsuccessResponses": {
"error.code": [
"Request_BadRequest",
"Authentication_MissingOrMalformed",
"Request_ResourceNotFound",
"Authorization_RequestDenied",
"Authentication_Unauthorized",
"BadRequest"
]
}
}
]
}
Let me know if this helps!
02/23/2024 04:17 AM
Hi @naveenss I could see country name (India & IN ) hardcoded in this sample JSON. However user may select any country as per their location, in this case, how come we get exact country code for that country name?
02/25/2024 11:18 AM
Let user input the Country using dynamic attribute. Use dynamic attribute in json and implement the logic
02/23/2024 04:23 AM
HI @Rajesh_IAM ,
You can have another attribute that will store country code and you can do this via Sav4Sav connector. Use that attribute in createAccountJson.
You can also write if else conditions in createAccount JSON itself but it will make your JSON complex.
Thanks,
Amit
If this answers your query, Please ACCEPT SOLUTION and give KUDOS.
02/23/2024 05:14 AM
Hi @AmitM Thank you for your response.
You can have another attribute that will store country code and you can do this via Sav4Sav connector. Use that attribute in createAccountJson >> Can you tell me how can I store country code via Sav4Sav connector.?
02/23/2024 05:38 AM - edited 02/23/2024 05:39 AM
You can have all country codes and name mapping stored in dataset and use that to find the respective code from name