mattkol/SugarOnRest

Updating linked fields via RequestType.Update not directly possible?

Closed this issue · 4 comments

I've noticed that updating linked fields via RequestType.Update does not work, I guess this has not been implemented (yet)? Basically I've created a custom class which extends the Contacts class and added a link to the EMailAddresses module/db table:

@JsonProperty("email_addresses")
    private List<EmailAddresses> emailLink;

Reading works fine with the LinkedBulkRead/LinkedReadById requestType. But changing the mail addresses does not have any effect on the database. I guess at the moment I would have to manually call Update (set_entry) on the EmailAddresses module and then set relationship to those mail addresses with set_relationship afterwards (not possible with SugarOnRest client, is it?).

BTW: I worked on this feature now in my fork, at least for creating objects (via set_entry, set_relationship). It looks like properly implementing update for objects with linked fields won't be easy, but I'll see. This whole feature is still work in progress :-) (storing simple objects with linked fields now works fine for my case).

That would be nice.

FYI: I described the feature I implemented at https://github.com/Frankst2/SugarOnRest#forkbranch-documentation, you may want to take a look at it. Basically it works very similar to GetLinkedEntry, but it's for creating entries. However I'm not sure if it's already ready for inclusion here as it might not do proper error checking yet. I hope I will find the time to finish that work.

That is a good idea.
I wanted to make it simple but not too simple, and easily extendable. So that would be a welcome addition for sure. Thanks.