Create multiple records in single request that are related

Hello Folks,

I am building a request body passing multiple records to be created in single request. All are related records. I have three levels in the relation, i.e., Record 1, Record 2 & Record 3.

Record 1 is the parent to Record 2.
Record 1 and Record 2 are parents to Record 3.

I can successfully create records Record 1,2 & 3.
Records 1 & 2 are linked correctly. Whereas, Record 3 is only linked to Record 2, and its missing relation to Record 1. Can someone help me with this.

Below is my request body for your reference. Contact and Opportunity are linked correctly. Whereas Task is linked to Opportunity alone, but i want it to be linked to Contact as well.

{
    "records": [{
        "attributes" : {"type": "Contact", "referenceId" : "con1"},
        "LastName" : "Jackson",
        "FirstName" : "Emily",
        "Opportunities" : {
            "records" : [{
                "attributes" : {"type" : "Opportunity", "referenceId" : "opp1"},
                "Name" : "Training",
                "tasks" : {
                    "records" : [{
                        "attributes" : {"type" : "Task", "referenceId" : "task1"},
                        "Priority" : "Normal",
                        "Subject"   : "Emily Jackson - Training"
                    }]
                }
            }]
        }
    }]
}

That will be down to how your API is designed.

You will need to check the API specification for details on whether that functionality is even possible.

Apart from that, the JSON itself seems to follow the same structure all of the way through.

The relationship shows the tasks linked to the opportunity, and the opportunity is linked to the contact. That is what the JSON is showing.

Not sure what you mean by wanting the task linked to the contact as well. You might need to add some more details on your use case to your question.

You are usually limited here to how the API is designed, or are you designing an API and asking for guidance on how to structure the JSON (which isn’t really a Postman question).

Hello Mike,

Thanks for you response.

I am new to POSTMAN scripts, and I was actually looking how to use Contact record while creating task from my JSON mentioned earlier.

Finally, i found @{con1.id}, which i can use to link Contact with Task record.

Best Regards,
Archana

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.