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

Multi select dynamic attribute value in Add Access Json

hemanthvn
New Contributor
New Contributor

Hello Team,

 

I have a requirement like  pass multi select dynamic attribute values to target system through Rest connect Add Access Json. could you please help me, How can we achieve this.

Please share me if anyone have correct syntax.

 

Thanks

Hemanth 

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

${requestAccessAttributes?.get('Dynamicattributename')}


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

hemanthvn
New Contributor
New Contributor

Hi Rushi,

Need to pass one value one time from the multi select dynamic attribute values. means if we select 2 values in multi select dynamic attribute we should sent one by one using List. do you have any syntax format for that.

Thanks

Hemanth

Rajesh-R
Saviynt Employee
Saviynt Employee

@hemanthvn 

  1. The value of the dynamic attribute is saved as the following selectvalue1,selectvalue2,selectvalue3
  2. We have to convert this into an array list with ',' (comma) as the delimiter value
  3. Iterate over the arraylist and convert it into Hashmap
  4. Build a JSON with the HashMap

Sample:

${Map tempMap = new HashMap(); ArrayList arr = <arrayList>; if(arr.size()>0){arr.eachWithIndex{ val, idx -> {<add your logic here> tempMap.put('<key>', <value>)}; tempBuilder = new groovy.json.JsonBuilder(tempMap); return tempBuilder.toString();}else{''}}


Thanks
Rajesh Ramalingam
Saviynt India

hemanthvn
New Contributor
New Contributor

Hi Rajesh,

I have tried using array and hashmap like below But still its i am getting an error and add access task not completing. 

${ArrayList worklist = new ArrayList();String[] workarray = account.customproperty14.split(',');for(int i = 0; i < workarray.size(); i++){LinkedHashMap<String, String> groupJsonMap = new LinkedHashMap<>();groupJsonMap.put('key1', 'XXXXX');groupJsonMap.put('key2', workarray[i].trim());worklist.add(groupJsonMap)}; return new groovy.json.JsonBuilder(worklist)}

could you please help on this.

Thanks

Hemanth

Rajesh-R
Saviynt Employee
Saviynt Employee

@hemanthvn  - Please provide the sample JSON which you need to pass as the payload.

 


Thanks
Rajesh Ramalingam
Saviynt India