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

REST Connector - #CONST# Declaration returns literal string Null, when empty string is expected

Kmlynars
New Contributor
New Contributor

Good Afternoon,

We are attempting to make use of the #CONST# syntax within the rest connector to populate the account type value based on the value of an attribute returned by the API Call.

Our colsToPropsMap within the ImportAccountEntJSON associated with the REST connector looks something like the follows. Please note that non-relevant properties have been stripped from the example below as the issue is only with recon of this specific property.

"colsToPropsMap": {
"accounttype": "#CONST#${response.profile.service_user == true ? 'Service Account': '' }~#~char"

}

And if we inspect the accounts, this is what we see for the accounttype for accounts within the endpoint:

Kmlynars_0-1676313862242.png

And so, if we try to update the colsToPropsMap with the following:

"colsToPropsMap": {
"accounttype": "#CONST#~#~char"

}

If we inspect the accounts, this is what we see for the accounttype for accounts within the endpoint:

Kmlynars_2-1676314659347.png

 

However, if we try to update the colsToPropsMap with the following:

"colsToPropsMap": {
"accounttype": "#CONST#${response.profile.service_user == true ? 'Service Account': 'User Account' }~#~char"

}

If we inspect the accounts, this is what we see for the accounttype for accounts within the endpoint:

Kmlynars_1-1676314185045.png

And so, essentially what we are looking for is a solution or an alternative approach where if this property "response.profile.service_user" is true, then the accounttype attribute is set as 'Service Account', and in all other cases it is not set at all, and essentially blank, much like the first 3 accounts marked SFIS in the last screenshot. It appears that the issue is with the #CONST# syntax itself,  as our second test case where we use the #CONST# syntax without a value contained within it should behave the same as an empty string would, and in this case we also see the literal string null being returned.

Any help that you can provide would be much appreciated. The goal of this approach is to ensure that this integration is consistent with what we have done in our past integrations, and as such we would like to avoid the use of a workaround like having to populate that field with a value such as 'User Account'.

Thanks,

Kyle Mlynarski

 

10 REPLIES 10

Sivagami
Valued Contributor
Valued Contributor

@Kmlynars - Did you try null instead of empty string?

"colsToPropsMap": {
"accounttype": "#CONST#${response.profile.service_user == true ? 'Service Account': null }~#~char"
}

-Siva

Good Afternoon,

Thank you for your response. Yes we have tried returning null instead of an empty string. The result is the same as case 2 as described above.

Thanks,

Kyle Mlynarski

Sivagami
Valued Contributor
Valued Contributor

Thanks @Kmlynars.

How about just having if condition?

 

"colsToPropsMap": {
"accounttype": "#CONST#${String acctType='Service Account'; if(response.profile.service_user == true){return acctType}}~#~char"
}

 

 -Siva

Good Afternoon,

Thank you for your response. Simply having an if condition still results in the literal string null being returned, as shown below.

Kmlynars_1-1676327570750.png

Thanks,

Kyle Mlynarski

Try below

"colsToPropsMap": {
"accounttype": "#CONST#${response.profile.service_user == true && 'Service Account'}~#~char"
}

Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

Kmlynars
New Contributor
New Contributor

Good Afternoon,

Thank you for your suggestion. The segment above yields the literal strings 'true' and 'false' for the account type field, ash shown below.

Kmlynars_0-1676327354538.png

Thanks,

Kyle Mlynarski

"accounttype": "#CONST#${ if('true'.equals(response.profile.service_user == true && 'Service Account')){return 'Service Account'}else {return 'Shared Account'}}}~#~char"

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Good Morning,

Thank you for your suggestion. The segment above yields 'Service Account}' for the account type field for all accounts, which is not what we are looking to accomplish. The field should be blank for non-service accounts, and be 'Service Account' for Service accounts.

Kmlynars_0-1676390755784.png

Kmlynars_1-1676391018855.png

However I believe that in addition to this issue, you have a mismatched number of curly braces in this code segment. I have included the updated code segment below:

"accounttype": "#CONST#${ if('true'.equals(response.profile.service_user == true && 'Service Account')){return 'Service Account'}else {return 'Shared Account'}}~#~char"

 The above yields the following:

Kmlynars_2-1676391219861.png

Kmlynars_4-1676391240330.png

Thanks,

Kyle Mlynarski

 

"accounttype": "#CONST#${ if('true'.equals(response.profile.service_user == true && 'Service Account')){return 'Service Account'}else {return ''}}~#~char"

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Good Afternoon,

Thank you for your suggestion. The segment above yields null for the account type field for all accounts, which is not what we are looking to accomplish. The field should be blank for non-service accounts, and be 'Service Account' for Service accounts.

Kmlynars_0-1676484622158.png

Kmlynars_1-1676484630430.png

Thanks,

Kyle Mlynarski