You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to set nested custom objects?

Question
6
Views
0
Comments
edited Sep 11, 2021 9:57PM in Integrations and APIs

Content

I am creating new incidents and I need to set a custom field:

Incident->parentObject->childObject->customField

 

What to put for childCustomObject.ObjectType.TypeName?

What to put for childCustomObjectField.name?

 

Code Snippet

GenericField customField = new GenericField();
customField.name = "testCustomField";
customField.dataType = DataTypeEnum.STRING;
customField.dataTypeSpecified = true;
customField.DataValue = new DataValue();
customField.DataValue.Items = new object[1];
customField.DataValue.Items[0] = "test";
customField.DataValue.ItemsElementName = new ItemsChoiceType[1];
customField.DataValue.ItemsElementName[0] = ItemsChoiceType.StringValue;

GenericObject childCustomObject = new GenericObject();
childCustomObject.GenericFields = new GenericField[] { customField};
childCustomObject.ObjectType = new RNObjectType();
childCustomObject.ObjectType.TypeName = ???

GenericField childCustomObjectField = new GenericField();
childCustomObjectField.name = ???
childCustomObjectField.dataType = DataTypeEnum.OBJECT;
childCustomObjectField.dataTypeSpecified = true;
childCustomObjectField.DataValue = new DataValue();
childCustomObjectField.DataValue.Items = new object[1];
childCustomObjectField.DataValue.Items[0] = customObjectGameCatalog;
childCustomObjectField.DataValue.ItemsElementName = new ItemsChoiceType[1];
childCustomObjectField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue;

GenericObject parentCustomObject = new GenericObject();
parentCustomObject.GenericFields = new GenericField[] { childCustomObjectField};  //???
parentCustomObject.ObjectType = new RNObjectType();
parentCustomObject.ObjectType.TypeName = "IncidentCustomFieldsParentCustomObject";

GenericField parentCustomObjectField = new GenericField();
parentCustomObjectField.name = "ParentCustomObject";
parentCustomObjectField.dataType = DataTypeEnum.OBJECT;
parentCustomObjectField.dataTypeSpecified = true;
parentCustomObjectField.DataValue = new DataValue();
parentCustomObjectField.DataValue.Items = new object[1];
parentCustomObjectField.DataValue.Items[0] = parentCustomObject;
parentCustomObjectField.DataValue.ItemsElementName = new ItemsChoiceType[1];
parentCustomObjectField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue;

Incident
Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!