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

Need Sample Create Account Json for Salesforce Rest Connector

rishabhgupta
New Contributor II
New Contributor II

Need Sample Create Account JSON for Salesforce Rest Connector with Profile ID mandatory

12 REPLIES 12

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @rishabhgupta,

Please find the sample below for the createaccountjson:

 
Specify this parameter to create an account in the target application.
 
Note: You must select a Profile while creating a new account.
 
To define additional attributes, add the following for the default configurations:
 
------------------Sample---------------------
{
"Username": "${user.email}",
"Alias": "${user.firstname.toString().substring(0,1)}${user.lastname.toString().substring(0,4)}",
"LastName": "${user.lastname}",
"FirstName": "${user.firstname}",
"CompanyName": "${user.orgunitid}",
"Department": "${user.departmentname}",
"Title": "${user.title}",
"Street": "${user.street}",
"City": "${user.city}",
"State": "${user.state}",
"PostalCode": "${user.customproperty19}",
"Country": "${user.country}",
"Email": "${user.email}",
"EmailPreferencesAutoBcc": true,
"EmailPreferencesAutoBccStayInTouch": false,
"EmailPreferencesStayInTouchReminder": true,
"Phone": "${user.secondaryPhone}",
"MobilePhone": "${user.phonenumber}",
"CommunityNickname": "${user.lastname}",
"IsActive": true,
"TimeZoneSidKey": "America/New_York",
"LocaleSidKey": "en_US",
"ReceivesInfoEmails": true,
"ReceivesAdminInfoEmails": true,
"EmailEncodingKey": "ISO-8859-1",
"LanguageLocaleKey": "en_US",
"EmployeeNumber": "${user.employeeid}",
"ProfileId":"${profileId}",
"UserPermissionsMarketingUser": false,
"UserPermissionsOfflineUser": false,
"UserPermissionsAvantgoUser": false,
"UserPermissionsCallCenterAutoLogin": false,
"UserPermissionsMobileUser": false,
"UserPermissionsSFContentUser": false,
"UserPermissionsInteractionUser": false,
"UserPermissionsSupportUser": false,
"ManagerId": "${ if (managerAccount == null || managerAccount?.accountID == null || managerAccount?.accountID == '' ){''} else {managerAccount?.accountID} }", "ContactId": "${user.customproperty26}",
"FederationIdentifier": "${user.email}",
"Working_Hours__c": null,
"SECO_Flag__c": false
}
------------------------------------------------
Thanks

If you find the above response useful, Kindly Mark it as "Accept As Solution".

rishabhgupta
New Contributor II
New Contributor II

@sudeshjaiswal I need sample create account json for Rest Connector (Salesforce)

 

Hi @rishabhgupta ,

Please see the below createAccountJSON for Salesforce

{
    "accountIdPath": "call1.message.id",
    "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
    "responseColsToPropsMap": {
        "status": "#CONST#1~#~char"
    },
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://<instance_url>/services/data/v44.0/sobjects/User",
            "httpMethod": "POST",
            "httpParams": "{\"Firstname\": \"${user.firstname!=null?user.firstname:''}\", \"LastName\": \"${user.lastname!=null?user.lastname:''}\",\"Username\":\"${user?.email}\",\"Alias\": \"${user?.customproperty60}\",\"Department\":\"${user.departmentname!=null?user.departmentname:''}\",\"Title\":\"${user.title!=null?user.title:''}\",\"Email\":\"${user.email}\",\"IsActive\":true,\"TimezoneSidKey\":\"Asia/Tokyo\",\"LocaleSidKey\": \"ja_JP\",\"EmailEncodingKey\": \"UTF-8\",\"LanguageLocaleKey\": \"ja\",\"ProfileId\":\"<default_profile_id>\",\"UserPermissionsSupportUser\":true,\"}",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    201
                ]
            },
            "unsuccessResponses": {
                "statusCode": [
                    400,
                    401,
                    404,
                    405,
                    500
                ]
            }
        }
    ]
}

. Replace <instance_url> and <default_profile_id> with the values from your instance. 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Thanks @naveenss , can you also provide add access json for rest connector (salesforce)

Create Account Json is really helpful, Thanks

Hi @rishabhgupta ,

Please see the add access json below for Profile, PermissionSet and Groups. Hope this helps!

{
  "call": [
    {
      "name": "PermissionSet",
      "connection": "acctAuth",
      "url": "https://<instance_url>/services/data/v44.0/sobjects/PermissionSetAssignment",
      "httpMethod": "POST",
      "httpParams": "{\"AssigneeId\":\"${account.accountID}\",\"PermissionSetId\":\"${entitlementValue.entitlementID}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
		"Accept": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          201
        ],
        "status": [
          "success"
        ]
      }
    },
	{
      "name": "Profile",
      "connection": "acctAuth",
      "url": "https://<instance_url>/services/data/v44.0/sobjects/User/${account?.accountID}",
      "httpMethod": "PATCH",
      "httpParams": "{\"ProfileId\":\"${entitlementValue.entitlementID}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
		"Accept": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          204
        ],
        "status": [
          "success"
        ]
      }
    },
	{
      "name": "Group",
      "connection": "acctAuth",
      "url": "https://<instance_url>/services/data/v44.0/sobjects/GroupMember",
      "httpMethod": "POST",
      "httpParams": "{\"userorGroupId\":\"${account.accountID}\",\"GroupId\":\"${entitlementValue.entitlementID}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
		"Accept": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          201
        ],
        "status": [
          "success"
        ]
      }
    }
  ]
}

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Thanks @naveenss 

Hi Naveen, can you please share remove access json for salesforce

Hi @rishabhgupta ,

Please find the remove access json below

{
    "call": [
        {
            "name": "Group",
            "connection": "acctAuth",
            "url": "https://<instance_url>/services/data/v44.0/query/?q=SELECT+Id+from+GroupMember+WHERE+userorGroupId='${account?.accountID}'+and+GroupId='${entitlementValue.entitlementID}'",
            "httpMethod": "GET",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    200,
                    201,
                    204
                ],
                "status": [
                    "success"
                ]
            }
        },
        {
            "name": "Group",
            "connection": "acctAuth",
            "url": "https://<instance_url>/services/data/v44.0/sobjects/GroupMember/${response.Group1.message.records[0].Id}",
            "httpMethod": "DELETE",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    204
                ],
                "status": [
                    "success"
                ]
            }
        },
		{
		  "name": "PermissionSet",
		  "connection": "acctAuth",
		  "url": "https://<instance_url>/services/data/v44.0/query/?q=SELECT+Id+FROM+PermissionSetAssignment+WHERE+AssigneeId='${account?.accountID}'+and+PermissionSetId='${entitlementValue.entitlementID}'",
		  "httpMethod": "GET",
		  "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
            },
		  "httpContentType": "application/json",
		  "successResponses": {
			"statusCode": [
			  200,201,204
			],
			"status": [
			  "success"
			]
		  }
		},
		{
		  "name": "PermissionSet",
		  "connection": "acctAuth",
		  "url": "https://<instance_url>/services/data/v44.0/sobjects/PermissionSetAssignment/${response.PermissionSet1.message.records[0].Id}",
		  "httpMethod": "DELETE",
		  "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
            },
		  "httpContentType": "application/json",
		  "successResponses": {
			"statusCode": [
			  204
			],
			"status": [
			  "success"
			]
		  }
		}
    ]
}
Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

This remove access json will not remove profile, need to remove profile as well

In Salesforce you cannot remove the profile. We can only update the profile to a standard default one. 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

prashantChauhan
Saviynt Employee
Saviynt Employee

@rishabhgupta Please use below REST CreateAccountJSON-

{
"accountIdPath": "call1.message.soap:Envelope.soap:Body.CreateResponse.Results.Object.ID",
"responseColsToPropsMap": {
"accountID": "call1.message.soap:Envelope.soap:Body.CreateResponse.Results.Object.ID~#~char",
"customproperty1": "call1.message.soap:Envelope.soap:Body.CreateResponse.Results.Object.AccountUserID~#~char",
"name": "call1.message.soap:Envelope.soap:Body.CreateResponse.Results.Object.UserID~#~char",
"customproperty3": "call1.message.soap:Envelope.soap:Body.CreateResponse.Results.Object.DefaultBusinessUnit~#~char"
},
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://<****>.soap.marketingcloudapis.com/Service.asmx",
"httpMethod": "POST",
"httpParams": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:u=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><s:Header><a:Action s:mustUnderstand=\"1\">Create</a:Action><a:To s:mustUnderstand=\"1\">https://<****>.soap.marketingcloudapis.com/Service.asmx</a:To><fueloauth>${access_token}</fueloauth></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><CreateRequest xmlns=\"http://exacttarget.com/wsdl/partnerAPI\"><Options><SaveOptions><SaveAction>UpdateAdd</SaveAction></SaveOptions></Options><Objects xsi:type=\"AccountUser\"><Client><ID>100021184</ID></Client><Name>${user?.firstname} ${user?.lastname}</Name><UserID>${user?.email}.eRM</UserID><CustomerKey>${user?.email}.eRM</CustomerKey><Email>${user?.email}</Email><NotificationEmailAddress>${user?.email}</NotificationEmailAddress><activeflag>true</activeflag><Password>Welcome12345678!</Password><MustChangePassword>true</MustChangePassword><DefaultBusinessUnit>515011375</DefaultBusinessUnit><SsoIdentities><SsoIdentity><IsActive>true</IsActive><FederatedID>${user?.customproperty62}</FederatedID></SsoIdentity></SsoIdentities></Objects></CreateRequest></s:Body></s:Envelope>",
"httpHeaders": {
"Content-Type": "text/xml"
},
"httpContentType": "text/xml",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}