Add-ERPObject creates an ERP entry but returns empty

Issue

Executing Add-ERPObject creates an entry in the ERP system but the Cmdlet returns empty. The logfile contains:

2021-06-30 11:52:44,283 [1] ERROR powerGate.Erp.Cmdlets.Cmdlets.ErpCmdletContext - AddErpObjectContext failed with exception: A node of type 'PrimitiveValue' was read from the JSON reader when trying to read the contents of an entity set reference navigation link; however, a 'StartObject' or 'StartArray' node was expected.
Microsoft.Data.OData.ODataException: A node of type 'PrimitiveValue' was read from the JSON reader when trying to read the contents of an entity set reference navigation link; however, a 'StartObject' or 'StartArray' node was expected.
at ..Execute[](Func`1 ?)
at ..( )
at .??.Create(Dictionary`2 ?)
at ...()
at .??.Invoke[](Func`1 ??)
at ..AddErpObject(Dictionary`2 ?)
at powerGate.Erp.Cmdlets.Cmdlets.Data.AddErpObjectContext.Execute(IErpEntitySet entitySet)
at powerGate.Erp.Cmdlets.Cmdlets.PsEntityCmdletContext`1.Run()
at powerGate.Erp.Cmdlets.Cmdlets.ErpCmdletContext.Run(ExecutionResult result)

Cause

This is caused by an issue in SAP. powerGate is able to create the ERP object but fails to process the response from ERP so the entry is created but there is no return value.

This could happen when a Field has a 1:N relationship but returns null.

Solution

Update your service to always return this Field.