ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Function Expose] OData Action Management - SetDeleteResponseLocation

Open ivandjordjevic opened this issue 7 years ago • 6 comments

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")

ivandjordjevic avatar Oct 30 '19 09:10 ivandjordjevic

@JesperSchulz

AlexanderYakunin avatar Nov 08 '19 11:11 AlexanderYakunin

@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:

image

But the function SetDeleteResponseLocation is not external:

image

What should we use for our custom API pages?

ivandjordjevic avatar Nov 11 '19 10:11 ivandjordjevic

Sorry about the delayed reply. A wrong configuration swallowed all my notifications from this repository. I will look into your issue soon!

JesperSchulz avatar Nov 13 '19 13:11 JesperSchulz

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;

nikolakukrika avatar Nov 14 '19 09:11 nikolakukrika

Ivan, if the answer works for you, could you close the issue? Thanks a lot!

JesperSchulz avatar Nov 14 '19 10:11 JesperSchulz

@JesperSchulz @nikolakukrika

That was definitely helpful!

Thanks a lot. Closing the ticket.

ivandjordjevic avatar Nov 15 '19 12:11 ivandjordjevic