API function - link option

Hi all,

I’m trying to create an API function that will update properties for a person record that is one object and create a new record from another, linked (one to many) object. However I cannot get a new record created in the linked object.

The main object holds person details. I can update that no problem using the below function.

Sending the payload below updates as expected.

{
    "payload": {
        "function": "update_person_using_liferay_id",
        "data": [
            {
            	"firstName": "Jim",
            	"lastName": "Bob 30",
               "userId": "206707631",
               "emailAddress": "jimbob30@test.camden.gov.uk"
            }
        ]
    }
}

I want the linked object to hold details of who made this change. I was hoping to do that by adding a field to the payload called “modifierEmailAddress”. I’ve create a new object linked to the person details with a one to many link from person details → changes object.

I had hoped I’d be able to use the “link” option something like:

Then modify my payload by adding:

"modifier": {
  "modifierEmailAddress": "test@test.camden.gov.uk"
}

However no matter what options I tick/select between link/link required/save it doesn’t ever create any records in the changes object.

Anyone got any knowledge or experience of this that can point out what I’m doing wrong?

Thanks,
Duncan

I think all you need to do to get this working is make your modifier payload an array of objects by adding []:

...
"modifier": [{
  "modifierEmailAddress": "test@test.camden.gov.uk"
}],
...

As for the check boxes, you should only need Save ticked, and you can set the Link dropdown as [None] as linking is not relevant in your scenario.

Brilliant. That works. Thanks very much.