function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pan K.Pan K. 

Upsert a record of custom object with lookup field using SmartSync

I would like to create a new custom object record in my mobile app, and push it to Saleforce server. I have following fieldlist in my model,

["Id", "RecordTypeId", "Name", "MUSW__Parcel__r.MUSW__Parcel_Number2__c", "MUSW__Scope__c", "MUSW__Severity__c"];

 

MUSW__Parcel__c is a lookup field from this object(Assessment) to another object(Parcel). I know that in order to get the record upsert, I have to send a REST request with a post body that looks like,

{
  "Name": "myRecordName",
  "MUSW__Scope__c": 2,
   "MUSW__Parcel__r" :
   {
       "MUSW__Parcel_Number2__c" : "019E00800000"
   }
  
}

  where MUSW__Parcel_Number2__c is a field in Parcel object.

 

My question really is how do I structure my fieldlist to get a nested JSON?

 

My POST now has a body of,

{"Name":"test","MUSW__Parcel__r.MUSW__Parcel_Number2__c":"019E00800000","MUSW__Scope__c":"3","MUSW__Severity__c":"Low"}

  and I get an error,

8B
[{"message":"No such column 'MUSW__Parcel__r.MUSW__Parcel_Number2__c' on sobject of type MUSW__Assessment__c","errorCode":"INVALID_FIELD"}]
0

 

 

Thanks!