Developer Q&A
Custom Field value
over 4 years ago by Lindsay Rader
Hi!
I can create work orders successfully, but now I need to add in a CustomField/Value. I was only able to find SOAP examples on how I should be creating the value, so this is what I thought would work based on SOAP, but I get an error.
var workOrder = new CORRIGO.WorkOrder {
TypeCategory = CORRIGO.WOType.Request,
SubType = new CORRIGO.WorkOrderType { Id = workOrderTypeId },
Customer = new CORRIGO.Customer { Id = customerId },
ContactName = contactName,
ContactAddress = new CORRIGO.ContactInfo {
AddrTypeId = CORRIGO.ContactAddrType.Contact,
Address = address,
},
// Add in a Custom Field value
CustomFields = new[] {
new CORRIGO.CustomField2 {
Descriptor = new CORRIGO.CustomFieldDescriptor { Name = "Event Related?" },
Value = "Custom Field String",
}
},
Priority = new CORRIGO.WoPriority { Id = priorityCode },
Items = new[] {
new CORRIGO.WoItem {
Asset = new CORRIGO.Location { Id = assetId },
Task = new CORRIGO.Task { Id = taskId, ModelId = modelId },
Comment = "comment",
}
},
};
I get this error message back:
not-null property references a null or transient value Corrigo.BO.Common.CfVal.Descriptor 0 NHibernate.PropertyValueException
I have verified that the Custom Field is defined in the database.
Any help in resolving this issue is appreciated.
Thanks,
Lindsay