Page 1 of 1

Purchase Order REST API

PostPosted: Thu May 10, 2018 10:56 pm
by minhhieu106
Hi Mike,

I try to create Supplier Purchase Order with REST API
Code: Select all
JiwaAPI/PurchaseOrders
. Below is the JSON

Code: Select all
{
   "CreditorRecID":"1                   ",
   "CreditorAccountNo":"5001",
   "OrderDate":"2018-05-10T20:32:57",
   "Reference":"444444444444",
   "OrderStatus":"3",
   "OrderType":"DefaultOrderType",
   "OrderSupplierType":"Creditor",
   "LogicalWarehouseOrderingFromRecID":"",
   "LogicalWarehouseOrderingFromDescription":"Creditor",
   "Lines":[ 
      { 
         "ItemNo":1,
         "InventoryId":"50a81a68936a40b8b107",
         "PartNo":"0U-GargBag",
         "Quantity":1.00000,
         "IncPrice":0.22000,
         "CustomFieldValues":[ 
            { 
               "SettingID":"86ef4833-362c-418f-a641-55379302fd66",
               "SettingName":"iVendKey",
               "Contents":"10000000000000100",
               "PluginID":"35a3cfba-99f2-4ed0-bcc9-3c44e02963ba",
               "PluginName":"iVendUDF"
            }
         ]
      }
   ]
}


The PO created in Jiwa successful but custom field did not update.

Image

Please advise how to update custom field.

Thanks,
Hieu

Re: Purchase Order REST API

PostPosted: Sat May 12, 2018 4:24 pm
by SBarnes
Hi

After having a quick look at it I suspect you may have found a bug as it would appear that the deserialisation code whilst calling code to deserialise the purchase order custom fields doesn't do it at the line level although I'l leave confirming it is a bug for Jiwa as I am not that familiar with the code and I could be missing something.

That said you should be able to get around the problem with some business logic plugin code as there is an event for when the DTO deserialisation ends with the following signature, where the sender will be the purchase order and the DTO will be the DTO Purchase order, all you would need to do is roll over the lines and transpose the data from one objects line to the others.

Code: Select all
 public delegate void DTODeserialiseEndEventHandler(object sender, EventArgs e, ref DTOType DTO);

Re: Purchase Order REST API

PostPosted: Mon May 14, 2018 2:58 pm
by minhhieu106
Hi Stuart,

Thanks for your reply. So in this case do you have any solutions to update custom field?

Thanks,
Hieu

Re: Purchase Order REST API

PostPosted: Mon May 14, 2018 3:37 pm
by Mike.Sheen
SBarnes wrote: I suspect you may have found a bug as it would appear that the deserialisation code whilst calling code to deserialise the purchase order custom fields doesn't do it at the line level although I'l leave confirming it is a bug for Jiwa as I am not that familiar with the code and I could be missing something.


Confirmed this occurs with 07.01.00 - custom line field value for the purchase order is not set when POSTing to /PurchaseOrders.

This does not occur in 07.01.01 - so we must have fixed that since.

Re: Purchase Order REST API  Topic is solved

PostPosted: Mon May 14, 2018 3:41 pm
by SBarnes
See my previous answer you can write plugin code against the business logic object to capture the end of the deserialisation and do the lines yourself.

Otherwise see Mike's answer and wait for the release of 7.01.01

Re: Purchase Order REST API

PostPosted: Mon May 14, 2018 11:11 pm
by minhhieu106
Got it!

Thanks all!