Hi Community Experts,
I have one situation with the PurchaseOrderLinesV2 Data entity,
I have added some custom fields with "Is Computable Field" property set to "No.
And some methods in the entity through extension and I am calling those methods inside the "onPostingLoad" event handler of that data entity.
This event handler is getting triggered fine and returning data in fields correctly when I am calling it through browser with this URL.
https://xxxxxxxxxxxxxxxxxxxxxxxxx.axcloud.dynamics.com/data/PurchaseOrderLinesV2
But when I call the same data entity from postman its not showing any data in the fields.
"OnPostingLoad" is getting called when I am calling the entity from postman, but it is not returning data as it returns in browser.
Where should I put my code to get data in my custom fields?
Usual helpful responses are expected :)
Best Regards.
Hi Martin,
Thanks for pointing me to the correct direction.
I just put the "Crosscompany" keyword in my select statement and its now working fine in postman as well.
Yes, VendRFQTrans isn't shared across companies, therefore your query returns VendRFQTrans record from the current company (if such a record exists). Even if you call the code with identical parameters, you'll may different result if it's executed in different company context.
If you aren't aware of any difference in the data (using a different company or different trans ID), use the debugger to see the difference there.
I suspect that VendRFQTrans isn't shared across companies (I can't check it at the moment) and therefore your code works correctly only if it's executed in the same company that you have in _dataAreaId.
Hi Martin,
Thanks for your suggestion about the extension class and event handler. I will do so.
Upon further debugging I have found-out this buffer only has data when I call the entity from browser.
When I call the same entity from Postman this buffer is empty.
The request URL is same in postman and browser, the data I am passing in the method is same. This buffer is behaving differently in case of postman.
Your first test is using OData too, therefore if it works there, it proves that it does work. You're probably using different parameters from Postman. Please test the same thing - copy the request URL that Postman is using and open it in a browser.
By the way, it seems that you've added an event handler to an extension class, which isn't the right approach and you should be getting a compuiler warning. The easist approach is using a CoC extension of postLoad().
If you insist on an event handler, put it to a separate class.
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156