Topic by Roy
Content
I've given up on trying to populate a custom object, instead we are now trying to fill a custom field... but for some reason the DataValue field isn’t being populated. Here is my code:
$generic_namespace = 'urn:generic.ws.rightnow.com/v1_2'; $GenericField3 = new RNGenericField(); $GenericField3->name = 'customfield'; $GenericField3->dataType = 'STRING'; $DataValue3 = new RNDataValue(); $DataValue3->StringValue = '1234567890'; $GenericField3->DataValue = $DataValue3; $genericObject3 = new RNGenericObject(); $genericObjectType3 = new RNObjectType(); $genericObjectType3->TypeName = 'IncidentCustomFieldsc'; $genericObject3->ObjectType = $genericObjectType3; $genericObject3->GenericFields = array($GenericField3); $genericFields = new RNGenericField(); $genericFields->name = 'c'; $genericFields->dataType = 'OBJECT'; $DataValue4 = new RNDataValue(); $DataValue4->ObjectValue = $genericObject; $genericFields->DataValue = $DataValue4; $genericObject = new RNGenericObject(); $genericObjectType = new RNObjectType(); $genericObjectType->TypeName = 'IncidentCustomFields'; $genericObject->ObjectType = $genericObjectType; $genericObject->GenericFields = array($genericFields); $genericObjectNS = new SoapVar($genericObject,SOAP_ENC_OBJECT,null,null,'CustomFields',$generic_namespace); $Incident->CustomFields = $genericObjectNS;
This results in the following XML:
<ns1:CustomFields xsi:type="ns2:GenericObject"> <ns2:ObjectType> <ns2:Namespace xsi:nil="true"/> <ns2:TypeName>IncidentCustomFields</ns2:TypeName> </ns2:ObjectType> <ns2:GenericFields dataType="OBJECT" name="c"> <ns2:DataValue/> </ns2:GenericFields> </ns1:CustomFields>
When I looks at the documentation I can see DataValue should contain an ObjectValue. As you can see, when I give the DataValue a property called ObjectValue it is simply ignored… I tried explicitly setting namespaces and types, but to no avail.
Does anyone have an idea on how to set a custom field in RightNow using PHP SOAP?