I am attempting to create a contact which contains the complex property, "WorkAddress". However, the SMP SDK does not seem to be recongizing the complex property, and therefor I receive the error:
Cannot set property 'WorkAddress' of type 'CRM_BUPA_ODATA.Address' to value of type 'null'.
The Entity is created with properties via:
func postOData(data: Dictionary<String, NSObject>, entityType: String, collectionPath: String, oDataResponse: ((ODataResponse) -> Void)?) {
var properties = [SODataPropertyDefault]()
for (key, value) in data {
let soDataProp = SODataPropertyDefault(name: key)
if value isDictionary<String, String> {
let data = value as! Dictionary<String, String>
let complexProperty = createComplexProperty(data)
soDataProp.value = complexProperty
} else {
soDataProp.value = value
}
properties.append(soDataProp)
}
let entity = SODataEntityDefault(type: entityType)
for property in properties {
entity.properties.setObject(property, forKey: property.name)
}
createEntity(entity, collectionPath: collectionPath, response: oDataResponse)
}
And the complex property is created via:
func createComplexProperty(data: Dictionary<String, String>) -> NSDictionary {
let properties = NSMutableDictionary(capacity: data.keys.count)
for (key, value) in data {
let soDataProp = SODataPropertyDefault(name: key)
soDataProp.value = value
properties[key] = soDataProp
}
returnNSDictionary(dictionary: properties)
}
The entity is then posted using store.scheduleCreateEntity()