Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/23/2023 02:15 AM
In SAP Connector we have Create, Update account json where we are currently using if else as below:
{"LOGONDATA":{
"USTYP":"A","GLTGV": "${user.startdate}","GLTGB": "${(user.enddate!=null)?({new java.text.SimpleDateFormat('yyyyMMdd').format(user.enddate)}):99991231}"
}}
Is it possible if we can have something like below
if user.statuskey=1 then send ustyp on the json else do not send ustype key value pair on the json
for eg
if user.statuskey==1?""USTYP":"A","GLTGV": "${user.startdate}","GLTGB": "${(user.enddate!=null)?({new java.text.SimpleDateFormat('yyyyMMdd').format(user.enddate)}):99991231}" : ""
08/23/2023 09:40 AM
@rituparna_pwc , I assume that you want to pass values to LOGONDATA ,only is user is active. Otherwise you want to send empty LOGONDATA?
Does it make a difference then sending as below:
"LOGONDATA":{
"GLTGB": "",
"USTYP": "",
"GLTGV:""
},
Alternatively try below also:
"LOGONDATA":"${
Map map1 = new HashMap();
if(user.statuskey==1)map1.put("USTYP",'A');
else map1.put("USTYP",'');
if(user.statuskey==1)map1.put("GLTGV",user.startdate);
else map1.put("GLTGV",'');
if(user.statuskey==1)map1.put("GLTGB",(user.enddate!=null)?({new java.text.SimpleDateFormat('yyyyMMdd').format(user.enddate)}):99991231);
else map1.put("GLTGB",'');
jsonBuilder = new groovy.json.JsonBuilder(map1);
return jsonBuilder.toString();
}"
08/23/2023 09:43 AM - edited 08/23/2023 09:55 AM
Hi,
No, I do not want to send USTYP at all if statuskey is not equal to 1. I do not want to send USTYP:"" . I want to omit this key value pair all together