cancel
Showing results for 
Search instead for 
Did you mean: 

$Batch Operation in OData for Account

former_member696894
Discoverer

Hello,

I'm trying to have batch operation for Account which includes services CorporateAccountCollection, ObjectIdentifierMappingCollection and CorporateAccountIdentificationCollection. I'm getting error message "Creation of entities with different authorization is not allowed in single transaction using this service." Here is my body:

--batch

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST CorporateAccountCollection HTTP/1.1

Content-Type: application/json

Content-ID: 2

Content-Length: 10000

{ "Name":"Testing Batch Operation MB", "RoleCode":"CRM000", "CountryCode":"US" }

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST ObjectIdentifierMappingCollection HTTP/1.1

Content-Type: application/json

Content-ID: 2 Content-Length: 10000

{ "RemoteIdentifierDefiningSchemeCode": "888", "RemoteBusinessSystemID": "CAMS", "RemoteObjectID":"M.123456.0000" }

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST CorporateAccountIdentificationCollection HTTP/1.1

Content-Type: application/json

Content-ID: 2

Content-Length: 10000

{ "IDTypeCode":"Z001", "IDNumber":'9999999999' }

--changeset--

--batch--

Do we need to reference the account object id from first call?

Thanks.

Regards,

MB

Accepted Solutions (0)

Answers (3)

Answers (3)

palu
Employee
Employee

Hi Mohan,

CorporateAccountIdentification is a child entity of CorporateAccount. The system is expecting a link for CorporateAccountIdentification entity inorder to post the record in the system. In order to achieve this, you need to use the Deep Insert in Batch.

Sample Payload :

--batch
Content-Type: multipart/mixed; boundary=changeset


--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary


POST CorporateAccountCollection HTTP/1.1
Content-Type: application/json
Content-ID: 2
Content-Length: 10000


{ "Name":"Testing Batch Operation MB", 
  "RoleCode":"XXXXX", 
  "CountryCode":"US", 
  "CorporateAccountIdentification" :


[{ "IDTypeCode":"XXXXXX", "IDNumber":"9999999999" }]
}


--changeset--
--batch--

Similarly, Find the Parent Entity of ObjectIdentifierMappingCollection and tried to pass the data using Deep Insert Format.

Regards,

Palani.

SCHNEIDERT
Active Contributor

Hi Mohanbabu,

not sure and a bit confused concerning the error message, but yes, reading the documentation I would say to create the Identification you need the object ID from the Account and do the POST to another Endpoint using CorporateAccountCollection.

Regarding the ObjectIdentifierMappingCollection there's no documentation available but as I can see in the OData Explorer, the ObjectID has "nullable:false", so I think you also have to provide it there, too, to do the POST.

BR Tobias

0 Kudos

Hi palu,

Can you please show your library & xsodata file code for deep insert in batch call.?

Thanks in advance.