Issue in getting dynamic attribute in DB update account JSON

avinashR
New Contributor
New Contributor

HI Team,

I am referring the dynamic attribute in the Grant access JSON and it is working as expected.

But when I am referring the same in update account JSON it is getting failed.

Expression I am using.

Dynamic attribute name: Role

Grant access Json:

{
"Client" : [
"EXEC Usp_add_user_role @I_LAN_ID = '${task.accountName}', @I_Lifecycle = 'DEV', @I_Role_ID = '${String rl;rl=Role;rl=rl.substring(rl.indexOf(\'_\')+1);if(rl != null){return rl}}', @I_Perform_By = 'Saviynt'"
]
}

Update Account JSON:

{"UpdateAccountQry":["EXEC Usp_add_user_role @I_LAN_ID = '${task.accountName}', @I_Lifecycle = 'DEV', @I_Role_ID ='${String rl;rl=Role;rl=rl.substring(rl.indexOf(\'_\')+1);if(rl != null){return rl}}', @I_Perform_By = 'Saviynt'"]}

FYI, I am storing the dynamic attribute in account cp5. So, I tried getting the value from it as well but it is also getting failed

Please let me know if you have any suggestions.

Thanks & Regards,
Avinash Repalle

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

Can you higlight DA in updateaccountjson

try ${Role}

Hope you are storing dynamic attribute value in accounts column

avinashR
New Contributor
New Contributor

${Role}: is returning value.

But my ${Role} will return something like access_125 then I need 125 in the update account JSON.

Issue: if I am using string functions along with ${Role} it is not working as expected

${Role}.split('_')[0]

Hi,

Is this confirmed working in 2021.x? Whenever I try to split in addaccessjson it shows syntax error while trying to save endpoint

Use. Substring 

I figured out what was wrong. In ${Role}.split("_")[0]. Instead of "_" need to user single quotes. Like '_'.