on 09-12-2014 12:22 PM
Dear community,
I need to implement a REST call to an external system passing through some data of PurchaseOrders.
The PurchaseOrders are part of a third-party process and created automatically by ByD from released SalesOrders.
The PurchaseOrders are created and automatically sent by ByD and afterwards saved by the system. The problem I'm facing is that at the time of the calls to AfterModify and BeforeSave, the ID field of the PO is not yet set.
Is there a way to get the ID in the AfterModify or BeforeSave before the PO is saved for the first time?
The only possible solution I came up with is to use internal communication to create an object. This message would be sent after the save and with the ID of the PO. Is another way to do it?
Thanks for your help and best regards,
Georg
Hi,
the ID will be generated only after the first save. Only the uuid is available before.
You can create a MDR in order to process the created sales orders after the initial save.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alessandro,
the REST service calls an external system to register the PO. The ID to identify POs in the external system and ByD should by identical which is why I need to know the ID. Furthermore, the PO should be posted to the external system almost immediately - so a mass data run is not really an option.
Thanks and best regards,
Georg
Hi,
Try with Number ranges, There are Function Modules available to get the next available PO Number
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Georg,
I do not know if you can implement this in a REST call, but you can access data which is not yet stored in the database with the Retrieve() function.
A query only queries what is saved in the database, so after the Save is done.
However, with the Retrieve(), you can find a Purchase Order with its ID, for example, before the Save is done.
I often use this function myself in Before-Save events. The after modify shouldn't be a problem as the instance already exists if you can modify it.
I hope this can help you!
Best regards!
Have a nice day.
Jacques-Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jacques-Antoine,
When the PurchaseOrder is created, my AfterModify / BeforeSave actions get called - so I have the BO instance of the PurchaseOrder that I need to do the REST-call stored in the "this" reference and as you state, I can modify it.
However, as this object is not yet stored it doesn't have an ID.
Do you mean that by calling the Retrieve() Function (e.g. var instance = PurchaseOrder.Retrieve(this.UUID); ) the system will set the ID?
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.