You need to sign in to do that
Don't have an account?
KiranNaidu
Issue while using composite tree API in workbench for Invoice and InvoiceLines
In the workbench Rest Explorer for Salesforce Billing App.I used Rest API with post method "/services/data/v49.0/composite/tree/blng__Invoice__c".
below is the JSON request body
{
"records" :[
{
"attributes" : {
"type" : "blng__Invoice__c",
"referenceId" : "ref1"
},
//InvoiceFields
"blng__Account__c": "0012y000006zj8uAAA",
"InvoiceInvoiceLines" : {
"records" : [
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref2"
},
"Name": "Test Product"
},
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref3"
},
"Name": "Test Product"
}]
}
}]
}
I get the below error "INVALID_FIELD
message: No such column 'InvoiceInvoiceLines' on sobject of type blng__Invoice__c
errorCode: INVALID_FIELD
"
Here "InvoiceInvoiceLines" is the Child relationship name.
Can someone help me in undestanding this issue.
below is the JSON request body
{
"records" :[
{
"attributes" : {
"type" : "blng__Invoice__c",
"referenceId" : "ref1"
},
//InvoiceFields
"blng__Account__c": "0012y000006zj8uAAA",
"InvoiceInvoiceLines" : {
"records" : [
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref2"
},
"Name": "Test Product"
},
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref3"
},
"Name": "Test Product"
}]
}
}]
}
I get the below error "INVALID_FIELD
message: No such column 'InvoiceInvoiceLines' on sobject of type blng__Invoice__c
errorCode: INVALID_FIELD
"
Here "InvoiceInvoiceLines" is the Child relationship name.
Can someone help me in undestanding this issue.
Let me know if it helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!
All Answers
Let me know if it helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!
You have to use the name of the relationship and also add the __r. Example:
{
"records" :[
{
"attributes" : {
"type" : "blng__Invoice__c",
"referenceId" : "ref1"
},
//InvoiceFields
"blng__Account__c": "0012y000006zj8uAAA",
"InvoiceInvoiceLines__r" : {
"records" : [
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref2"
},
"Name": "Test Product"
},
{
"attributes" : {
"type" : "blng__InvoiceLine__c",
"referenceId" : "ref3"
},
"Name": "Test Product"
}]
}
}]
}