Skip to content

Invalid Child left irreconciliable if Parent is synced successfully when using Parent/Children Sync Up Target #3275

@jpmonette

Description

@jpmonette

Please fill out the following details:

  1. Version of Mobile SDK Used: 8.2.0
  2. Issue found in Native App or Hybrid App: React-Native
  3. OS Version: 10.15.5 (19F101)
  4. Device: Simulator (iPad)
  5. Steps to reproduce:

Currently have the following Parent/Children Sync Up in place:

{
  iOSImpl: "SFParentChildrenSyncUpTarget",
  createFieldlist: ["Id", "Name"],
  updateFieldlist: ["Id", "Name"],
  childrenCreateFieldlist: ["Id", "FirstName", "LastName", "AccountId"],
  childrenUpdateFieldlist: ["Id", "FirstName", "LastName", "AccountId"],
  parent: {
    idFieldName: "Id",
    sobjectType: "Account",
    modificationDateFieldName: "LastModifiedDate",
    soupName: "AccountTest",
  },
  relationshipType: "MASTER_DETAIL",
  type: "rest",
  modificationDateFieldName: "LastModifiedDate",
  children: {
    parentIdFieldName: "AccountId",
    idFieldName: "Id",
    sobjectType: "Contact",
    modificationDateFieldName: "LastModifiedDate",
    soupName: "ContactTest",
    sobjectTypePlural: "Contacts",
  },
  idFieldName: "Id",
}
  1. Insert locally a valid Account with Id = local_1
  2. Insert locally an invalid Contact with AccountId = local_1, but without a LastName
  3. Run SyncUp
  1. Actual behavior:

Account is created, but Contact isn't. This is okay, except that the Contact does not have its AccountId replace, which makes it impossible to reconciliate afterward to the parent Account.

Accounts:

[
  {
    "__local__": false,
    "_soupEntryId": 13,
    "__locally_deleted__": false,
    "Id": "0012R00002B3pkyQAB",
    "__locally_updated__": false,
    "__locally_created__": false,
    "_soupLastModifiedDate": 1601305456881,
    "Name": "Sample Account",
    "attributes": {
      "type": "Account"
    }
  }
]

Contacts:

[
  {
    "__last_error__": "[\n  {\n    \"message\" : \"Required fields are missing: [LastName]\",\n    \"fields\" : [\n      \"LastName\"\n    ],\n    \"errorCode\" : \"REQUIRED_FIELD_MISSING\"\n  }\n]",
    "__local__": true,
    "_soupEntryId": 9,
    "__locally_updated__": true,
    "__locally_deleted__": false,
    "AccountId": "local_1",
    "LastName": "Jack",
    "Id": "local_dummy_id",
    "_soupLastModifiedDate": 1601305589200,
    "attributes": {
      "type": "Contact"
    },
    "__locally_created__": true
  }
]
  1. Expected Behavior:

Contact should either have AccountId replaced from local_1 to 0012R00002B3pkyQAB after syncUp OR Account should not be created, leaving its ID value to local_1.

Accounts:

[
  {
    "__local__": false,
    "_soupEntryId": 13,
    "__locally_deleted__": false,
    "Id": "0012R00002B3pkyQAB",
    "__locally_updated__": false,
    "__locally_created__": false,
    "_soupLastModifiedDate": 1601305456881,
    "Name": "Sample Account",
    "attributes": {
      "type": "Account"
    }
  }
]

Contacts:

[
  {
    "__last_error__": "[\n  {\n    \"message\" : \"Required fields are missing: [LastName]\",\n    \"fields\" : [\n      \"LastName\"\n    ],\n    \"errorCode\" : \"REQUIRED_FIELD_MISSING\"\n  }\n]",
    "__local__": true,
    "_soupEntryId": 9,
    "__locally_updated__": true,
    "__locally_deleted__": false,
    "AccountId": "0012R00002B3pkyQAB",
    "LastName": "Jack",
    "Id": "local_dummy_id",
    "_soupLastModifiedDate": 1601305589200,
    "attributes": {
      "type": "Contact"
    },
    "__locally_created__": true
  }
]
  1. Error Log:

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions