0

I created a composite REST to insert opportunity for existing account, but all the GET method return error resource not found.. someone help

{
"allOrNone" : true,
"compositeRequest" : [{
    "method" : "GET",
    "referenceId" : "GetAccountId",
    "url" : "/services/data/v42.0/query/?q=select+id+from+contact+where+SAP_Account_Id__c=1213019"
},
{
    "method" : "GET",
    "referenceId" : "GetAccountDivisionId",
    "url" : "/services/data/v42.0/query/?q=select+id+from+Account_Division__r+where+SAP_External_Key__c='1213019'"
},
{
    "method" : "GET",
    "referenceId" : "GetSalesOfficeId",
    "url" : "/services/data/v42.0/query/?q=select+id+from+Sales_Office__r+where+SAP_External_Key__c='1213019'"
},
{
    "method":"POST",
    "url":"/services/data/v45.0/composite/tree/Opportunity",
    "referenceId":"CreateOpportunity",
    "body": {
        "attributes" : {"type" : "Opportunity", "referenceId" : "CreateOpportunity"},
        "name" : "Test",
        "AccountId" : "@{GetAccountId.records[0].Id",
        "Account_Division__r" : "@{GetAccountDivisionId.records[0].id}",
        "Plant__c" : "JKT",
        "Amount_Estimated__c" : "1000",
        "SAP_Inquiry_ID__c" : "INQ121319",
        "Sales_Office__r" : "@{GetSalesOfficeId.records[0].id}",
        "Inquiry_Amount_Original_Currency__c" : "1000",
        "Exchange_Rate__c" : "14000",
        "CloseDate" : "2019-12-30T18:25:43.511Z",
        "StageName" : "Preparation",
        "Data_Synced_to_SAP__c" : true,
        "LeadSource" : "Other"
    }
}]

}

  • Is it working if you use only the request /services/data/v42.0/query/?q=select+id+from+contact+where+SAP_Account_Id__c=1213019 in Workbench? – Paris Nov 15 '19 at 9:13
0

You cannot query from either Account_Division__r or Sales_Office__r. The __r notation is for relationships. These are the 'REST Resource(s) not found'

If they are relationships to Contact, you would need to query the SObject(s) and use the Id from Contact to limit the query further. You need to replace __r with __c to access the SObjects.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.