如何在自定义区域中使用cloudkit js分配对记录的引用?

时间:2018-01-29 15:36:00

标签: javascript cloudkit

这就是我现在所拥有的:

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"
};

我创建了区域territories,但这已成功保存到icloud但保存到默认区域。为什么呢?

问题是:

  • 如何在我的自定义区域中为我的设置记录分配territory引用:territories
  • 如何将其保存在自定义区域?

1 个答案:

答案 0 :(得分:1)

您需要在此记录中添加父级域名:

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"
    }
};