Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

How to save customproperty when creating an account in an external jar connector

John_H_Jeon
New Contributor II
New Contributor II

I want to save the customproperty while creating an account in Jar connector, just as I use "responseColsToPropsMap" to save account properties in REST Connector.

CreateAccountJSON

{
"fullyQualifiedClassName": "com.sav.connector.sample1.DemoCase1",
"methodName": "createAccount",
"arguments": {
"api_base_url": "${connectionJSON.api_base_url}",
"api_token": "${connectionJSON.api_token}",
"api_path": "/ECM/api/v5/createAccount",
"api_method": "post",
"api_param": "{\"securitysystem\": \"JarConnector_DEMO\", \"endpoint\": \"JarConnector_DEMO_Source\", \"name\": \"${arsTasks?.getAccountName()}\", \"description\": \"${users?.username}\", \"displayname\": \"${users?.systemUserName}\"}"
}
}

 

public static String createAccount(Map<String, Object> arg)
{
System.out.println(StrUtil.getClassMethodName("START"));

for (Map.Entry<String, Object> entry : arg.entrySet())
System.out.println("============================ PARAM key : " + entry.getKey() + ", valueClass : " + entry.getValue().getClass().getName() + ", value : " + entry.getValue().toString());

String message = StrUtil.orElse(arg.get("message"), "Success");
String description = StrUtil.orElse(arg.get("description"));

JSONObject returnJsonObject = new JSONObject();

try
{
SaviyntAPIManager client = SaviyntAPIManager.getInstance(StrUtil.orElse(arg.get("api_base_url")), StrUtil.orElse(arg.get("api_token")));
client.sendBasicRequest(StrUtil.orElse(arg.get("api_path")), StrUtil.orElse(arg.get("api_method")), StrUtil.orElse(arg.get("api_content_type")), StrUtil.orElse(arg.get("api_param")));

}
catch (Exception e)
{
e.printStackTrace();
message = "Failure";
description = e.getMessage();
}

returnJsonObject.put("data", StrUtil.orElse(arg.get("accountID")));
returnJsonObject.put("message", message);
returnJsonObject.put("description", description);
System.out.println(returnJsonObject);
System.out.println(StrUtil.getClassMethodName("END"));
return returnJsonObject.toString();
}

What value should I put in the "returnJsonObject"?

 

2 REPLIES 2

Rishi
Saviynt Employee
Saviynt Employee

@John_H_Jeon we are reviewing this internally and will provide the samples shortly.

nimitdave
Saviynt Employee
Saviynt Employee

It depends on which api you are using to create account:

1.

curl --location -g '{{url}}/ECM/{{path}}/createAccount' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data '{
"securitysystem": "System1",
"endpoint": "System1",
"name": "johnWS",
"username": "johndoe",
"requestor": "admin",
"accountowner": [
{
"type": "user",
"value": "dbailey",
"rank": "1"
}
],
"description": "test",
"displayname": "testaccc",
"comments": "10282",
"accountid": "123",
"customproperty1": "1212",
"customproperty30": "1212",
"passwordchangestatus": "changed",
"privileged": "true",
"usergroup": "testgroup",
"accounttype": "service account",
"incorrectlogons": "12",
"orphan": "true",
"validfrom": "11-03-2019",
"validthrough": "10-03-2019",
"lastlogondate": "10-03-2019",
"passwordlockdate": "10-03-2019"
}

 

2. And if you are using createrequest api, then you have to create dynamic attributes in the form for app and map them to respective CP.