Deep Insert last line insert triggering or whole batch insert triggering

102 Views Asked by At

I create API pages to use deep insert. And fond out laсk of information about this topic. For example:

  1. how to trigger the last line inserting in the request ? (I'm going to run a codeunit after that). Without adding extra marker-fields. Trigger "OnClosePage" doesn't work.
  2. how to trigger/handle response text and status? Is it possible?
  3. Are there some documentation with step by step explanation how it works and what we can handle/trigger from BC?

Many thanks

I tried all API triggers and extra marker-fields but no success. I'm expecting whole request handle/triggering step by step. But the main problem is last line inserts triggering.

1

There are 1 best solutions below

0
On

The API Page has no idea when you are done inserting data i.e., it does not know that the last line has been processed.

One solution could be to add a Bound Action to your API Page which you then call when you are done inserting the data.

To create a Bound Action you need to add the ServiceEnabled property to a public procedure on the API page:

[ServiceEnabled]
procedure DoStuff(var ActionContext: WebServiceActionContext)
begin
    // Do the stuff

    // Set the relevant result code
    ActionContext.SetResultCode(WebServiceActionResultCode::Updated);
end;