picqer / exact-php-client

PHP Client library for Exact Online
MIT License
165 stars 201 forks source link

Retrieving custom fields of SalesOrders #657

Closed Camielluijpen closed 1 month ago

Camielluijpen commented 2 months ago

I need to retrieve the CustomFields of a SalesOrder. We do use Exact Online Premium and I know the fields are added to the SalesOrder. I see the CustomFields property on many models, like SalesOrderLines and Contact, but not on the SalesOrder.

When I customize the SalesOrder class and add it as a fillable, I do get the corresponding URL: image

However, that's how far as I can get. Can't find a way to then retrieve the custom fields of the SalesOrder. I've also tried to use the CustomField/CustomFields endpoint, but the UUID needed for the 'linkId' filter I get from the URL in the screenshot above is nowhere to be found in the SalesOrder, so that doesn't seem to work.

I'm using the REST SalesOrders/SalesOrder endpoint. If you look at the Exact Online REST documentation, the CustomField property is also there on the SalesOrder endpoint: https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesOrderSalesOrders image

Please let me know if there are any more questions or if I'm missing something.

remkobrenters commented 2 months ago

The field was added a bit ago by Exact Online and it will be added in the next update (https://github.com/picqer/exact-php-client/pull/656/files#diff-dba0bc035533d6ca8ee3274e0a86b5700494c9973dfc293979295e8748447b47R106).

The linkId and bcName name you get in this field are the ones you need to get the customfields for this resource. What do you mean with "is nowhere to be found in the SalesOrder, so that doesn't seem to work."?

Camielluijpen commented 2 months ago

Hey Remko,

Thanks, good to hear that it's already handled!

The linkId and bcName name you get in this field are the ones you need to get the customfields for this resource. What do you mean with "is nowhere to be found in the SalesOrder, so that doesn't seem to work."?

With this I meant that I expected the linkId to be the same as the SalesOrder guid, since I believe it's meant to be used to retrieve the CustomFields of that same SalesOrder, but the linkId is different than the SalesOrder guid. But since I have no experience yet with CustomFields, I might just be entirely wrong.

remkobrenters commented 2 months ago

But did you verify the data returned when you used the provided linkId and bcName does not belong to the sales order?

Camielluijpen commented 2 months ago

Hey Remko,

I've been able to make it work, thanks though! Do you have an indication of when the release of this update will be?

remkobrenters commented 2 months ago

Cool. Regarding the update. Not sure but Stephan is often very fast. Maybe he is busy or on vacation.