Skip to Content

How to get PO id from Validation: OnSave event

Mar 15, 2017 at 07:38 AM


avatar image

Dear Experts,

Below is my scenario:

I am triggering an external webservice in the event Validation: OnSave of purchase order which will be created on release of sales order .

I need to pass the purchase order Id to the web service parameter .So I added the code as below in Validation: OnSave event :

Request.request.PurchaseOrderId = _this.ID.content;

But _this.ID returns value as "##2".

What is this and how to pass PO id .



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Schaude
Mar 16, 2017 at 12:47 PM

Hello Resmi,

I guess the ID is only finalized during the internal Save process.

What is the value in the event "BeforeSave"?

. Horst

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Horst,

Its same(##2) in event "before save " also . See the attached screenshot.

po-id.png (46.3 kB)

Hello Resmi,

But I assume the UUID is valid?

In this case it is possible that you create a "shadow" BO whic has nothing inside than the UUID of the Purchase order and an action to trigger the Web Service.
After the successfull triggering the BO instance deletes itself.

Then you can define a MassDataRun with a short cycle on this shadow BO which calls this action.

. Horst

BTW: It is a not-so-good practive to call a Web Service in a BeforeSave event as the waiting for the WS call slows down the peformance of the save. Better do it afterwards and asynchronously.