[Function Expose] OData Action Management - SetDeleteResponseLocation
Can we have following function in in Codeunit 6711 OData Action Management publicly available:
SetDeleteResponseLocation(VAR ActionContext : DotNet "Microsoft.Dynamics.Nav.Runtime.WebServiceActionContext";EntityObjectId : Integer)
We use this function in one of our API pages for Service Enabled functions (bound actions) where we set action context:
LOCAL SetActionResponse(VAR ActionContext : DotNet "Microsoft.Dynamics.Nav.Runtime.WebServiceActionContext";VAR MyRecord : Record "My Record")
ODataActionManagement.AddKey(FIELDNO("Entry No."),MyRecord ."Entry No.");
ODataActionManagement.SetDeleteResponseLocation(ActionContext,PAGE::"My Page")
@JesperSchulz
@AlexanderYakunin @JesperSchulz Any advice on how to proceed here?
Basically we are using in our API pages same thing you have on SalesQuoteEntity.Page.al for service enabled functions:

But the function SetDeleteResponseLocation is not external:

What should we use for our custom API pages?
Sorry about the delayed reply. A wrong configuration swallowed all my notifications from this repository. I will look into your issue soon!
Hi Ivan,
It is not needed, you should use the built in keyword instead - WebServiceActionContext. You can see the examples in the APIV1 extension, sample code is here: local procedure SetActionResponse(var ActionContext: WebServiceActionContext; InvoiceId: Guid) var begin SetActionResponse(ActionContext, Page::"APIV1 - Sales Invoices", InvoiceId); end;
local procedure SetActionResponse(var ActionContext: WebServiceActionContext; PageId: Integer; DocumentId: Guid)
var
begin
ActionContext.SetObjectType(ObjectType::Page);
ActionContext.SetObjectId(PageId);
ActionContext.AddEntityKey(FieldNo(Id), DocumentId);
ActionContext.SetResultCode(WebServiceActionResultCode::Deleted);
end;
Ivan, if the answer works for you, could you close the issue? Thanks a lot!
@JesperSchulz @nikolakukrika
That was definitely helpful!
Thanks a lot. Closing the ticket.