1

I've added some custom fields to link a Kit Asm back to a particular Sales Order Line. When the Kit Asm is released, I want to update my custom field Qty Released on the linked SO Line.

My code is working for other changes to the Kit Asm (which I kick off from an overridden Persist method), but the base Acumatica Release takes place inside a PXLongOperation, so my count of the qty on Kit Asms that are released is inaccurate, because they aren't actually released immediately after the base.release.Press().

Also due to the PXLongOperation, the event handler for Kit Asm Released field updated is never raised, so I can't capture it from there.

And the Persist doesn't seem to get raised at any point after the Release is completed.

Is there a way I can track the progress of the base Release and wait until the PXLongOperation completes before trying to update my SO?

June B
  • 141
  • 10

1 Answers1

2

The processing of Kits should call INDocumentRelease. You could extend this graph and when done update your sales order. Just check for the doctype as all inventory transactions process through INDocumentRelease. In here you can override persist and/or look at any events you might need. Persist override should work. This way once the document is marked as released you know the process completed without error and you are safe to update the sales order.

Brendan
  • 5,428
  • 2
  • 17
  • 33
  • Hi @Brendan, May you please suggest or give example which event to override to identify the kit is released like you suggest persistevent should override, may you give example here? Also after releasing the Kit, I want to update a Extension table of INKitRegister (InKitRegister), How may i do that, as i got the error on updating Kit assembly "got the error Serial Number 'SRF000' for item 'ABC001' is already received " Any comment? – user_mat May 19 '20 at 12:45
  • @amit you should look at the methods available in INDocumentRelease but maybe at least look at overriding the Persist call. Here is an example overriding persist: https://stackoverflow.com/a/61893415/2056380 – Brendan May 19 '20 at 14:35
  • you just need to override persist and perform you logic (check for transaction is kit assembly and released) and then update your DACs/Extensions. Then call base persist. There is no action to be added to INDocumenetRelease. It is already called when you are releasing the kit assemblies – Brendan May 19 '20 at 14:52
  • I meant INReleaseProcess which is what does the processing of the transacitons. INDocumenetRelease just loops the releasing documents and calls INReleaseProcess – Brendan May 19 '20 at 14:56
  • I did, But after release INKITRegister, I am updating the extension table of INKitRegister then I am getting error "Serial Number 'SRF000' for item 'ABC001' is already received " , why? – user_mat May 19 '20 at 15:07
  • Are you updating your extension table of INKitRegister before the base persist? And my guess something is triggering an event that make it think like someone is updating the kit record for a new entry – Brendan May 19 '20 at 15:45
  • I can not do before persist because My transaction might be failed so it may impact the saving of KitAssembly, i want to update my values in KitAssembly after whole KitAssembly finished its transaction. Might be another event is raising which is creating a record, any suggestion because i want to update KitAssembly extension in custom action also? – user_mat May 20 '20 at 04:40
  • Overriding the persist on INReleaseProcess will work. I just confirmed when releasing a kit document that the persist will show the lines as released and give you a chance to update your extension values before base persist. No need for custom action. If you do it in a custom action this would be a separate process which would create a disconnect. I would update the same time the document is saving as released. – Brendan May 27 '20 at 16:46
  • Posted answer here: https://stackoverflow.com/a/62048633/2056380 – Brendan May 27 '20 at 16:59