Purchase Order REST API  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Purchase Order REST API

Postby minhhieu106 » Thu May 10, 2018 10:56 pm

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
Attachments
SPO.PNG
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0

Re: Purchase Order REST API

Postby SBarnes » Sat May 12, 2018 4:24 pm

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);
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Purchase Order REST API

Postby minhhieu106 » Mon May 14, 2018 2:58 pm

Hi Stuart,

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

Thanks,
Hieu
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0

Re: Purchase Order REST API

Postby Mike.Sheen » Mon May 14, 2018 3:37 pm

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Purchase Order REST API  Topic is solved

Postby SBarnes » Mon May 14, 2018 3:41 pm

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
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Purchase Order REST API

Postby minhhieu106 » Mon May 14, 2018 11:11 pm

Got it!

Thanks all!
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests