forcedotcom / forcedotcom/SalesforceMobileSDK-iOS

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

Open
#3,275 1 comment 0 reactions 0 assignees View on GitHub
backlog bug
Dominant language
Objective-C
Stars
553
Forks
425
Avg merge
18h 6m
Merged PRs (30d)
37

Description

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:

```ts
{
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

6. 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:
```json
[
{
"__local__": false,
"_soupEntryId": 13,
"__locally_deleted__": false,
"Id": "0012R00002B3pkyQAB",
"__locally_updated__": false,
"__locally_created__": false,
"_soupLastModifiedDate": 1601305456881,
"Name": "Sample Account",
"attributes": {
"type": "Account"
}
}
]
```

Contacts:

```json
[
{
"__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
}
]
```

7. 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:
```json
[
{
"__local__": false,
"_soupEntryId": 13,
"__locally_deleted__": false,
"Id": "0012R00002B3pkyQAB",
"__locally_updated__": false,
"__locally_created__": false,
"_soupLastModifiedDate": 1601305456881,
"Name": "Sample Account",
"attributes": {
"type": "Account"
}
}
]
```

Contacts:

```json
[
{
"__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
}
]
```

8. Error Log:

None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.