Skip to main content

Hi Ohana,

 

I am writing a composite call to create products and add them to strandard Pricebook.

{

"allOrNone": true,

"collateSubrequests": false,

"compositeRequest": [

{

"method": "GET",

"referenceId": "refProductRecordType",

"url": "/services/data/v56.0/query/?q=SELECT+id+FROM+RecordType+WHERE+SobjectType+='Product2'+AND+DeveloperName+='Product'"

},

{

"method": "PATCH",

"referenceId": "refProdList",

"url": "/services/data/v56.0/composite/sobjects/Product2/External_Id__c",

"body": {

"allOrNone": true,

"records": [

{ "attributes" : {"type" : "Product2", "referenceId" : "prod0"},

"RecordTypeId": "@{refProductRecordType.records[0].Id}",

"Name":"product 1",

"External_Id__c" : "12121",

"Description" : "bla bla",

"IsActive" : true

}

]

}

},

{

"method": "GET",

"referenceId": "refPricebook",

"url": "/services/data/v56.0/query/?q=SELECT+id+FROM+Pricebook2+WHERE+Name+='Standard Price Book'+AND+IsStandard+=+true"

},

{

"method": "POST",

"referenceId": "refPbe",

"url": "/services/data/v56.0/sobjects/PricebookEntry",

"body": {

"Pricebook2Id": "@{refPricebook.records[0].Id}",

"Product2Id":"@{prod0.Id}",

"UnitPrice" : 0.00,

"IsActive" : true

}

}

]

}

When I try executing this composite POST call, I get error :

{

"body" : [ {

"errorCode" : "PROCESSING_HALTED",

"message" : "Could not find the referenced operation prod0"

} ],

"httpHeaders" : { },

"httpStatusCode" : 400,

"referenceId" : "refPbe"

}

I am trying to access the referenceId "prod0", but not sure how to get it because it's kind of a nested reference or if it's possible to access such a reference.

 

Any help would be appreciated.

Thanks!

답변 1개
0/9000