Why when I used "master:false", no records were fetched, but when I removed that feature, it fetched records as expected?


Answer.

The one of most likely reasons of the issue is that you probably have ALL objects in you configuration set to **master:false. **

Typically at least one of the objects should be a master.

Let see the example of three related objects:

{
     "objects": [
         {
              "query": "SELECT all FROM Contact",
              "operation": "Upsert",
              "externalId": "Name",
              "master": false
         },
         {
              "query": "SELECT all FROM Account",
              "operation": "Upsert",
              "externalId": "Name",
              "master": false
         },
         {
              "query": "SELECT all FROM AccountContactRelation",
              "operation": "Upsert",
              "externalId": "AccountId;ContactId",
              "master": false
         }
     ]
}

The resolution.

  • Put the Account object to master:true (it's a default value, so simple remove this property). 
  • Leave the configuration for the AccountContactRelation and Contact to be master:false so they will remain a "slave" objects and their records will be fetched automatically in relation to the fetched Account records.

The final working configuration would be:

{
     "objects": [
         {
             "query": "SELECT all FROM Contact",
             "operation": "Upsert",
             "externalId": "Name",
             "master": false
         },
         {
             "query": "SELECT all FROM Account",
             "operation": "Upsert",
             "externalId": "Name"
         },
         {
             "query": "SELECT all FROM AccountContactRelation",
             "operation": "Upsert",
             "externalId": "AccountId;ContactId",
             "master": false
         }
     ]
}
Last updated on 29th Jan 2023