Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61880

How to assign reference to record using cloudkit js in custom zone?

This is what I have now:

var set = {
    recordType: 'Set', 
    fields: {
       name: { 
           value: 'AAB', 
           type: 'STRING' 
       },
       territory: {
           value: {
               recordName: "4CCA13D2-F52A-47D0-A690-46A556D0CB38",
               action: "DELETE_SELF", 
               zoneID: "territories"
           }, 
           type: "REFERENCE"
        }
    }, 
    zoneID: "territories"
};

I have created zone territories but this is succesfully saved to icloud but to default zone. Why?

The questions are:

Upvotes: 0

Views: 114

Answers (1)

user1285813
user1285813

Reputation:

you need to add territory parent to this record:

var set = {
    recordType: 'Set',
    fields: {
        name: { value: 'WWWWW', type: 'STRING' },
        territory: {
            value: {
                recordName: "4CCA13D2-F52A-47D0-A690-46A556D0CB38",
                action: "DELETE_SELF", zoneID: "territories"
            },
            type: "REFERENCE"
        }
    },
    zoneID: "territories",
    parent:
    {
        recordName: "4CCA13D2-F52A-47D0-A690-46A556D0CB38"
    }
};

Upvotes: 1

Related Questions