Hi all,
Is there a way to define method and call it in a API type page.
Here is he scenario.
I have defined a page of type Api.
I will like to call this page, send it parameters so that it can send JSON results as the parameters indicates.
eg:
- procedure getalltables(): that will return me all objects(tables) in json.
- procedure getcompanies(): will return all companies.
- procedure getrecordColumns(companyid, tableid):
- procedure getrecords(companyid, tableid.colums): will return me items of that table
- etc
I have defined a sample page as below:
page 50120 TargitServices
{
PageType = API;
APIPublisher = 'targitas';
APIGroup = 'services';
APIVersion = 'v1.0';
EntitySetName = 'targitServices';
Caption = 'targitServices';
EntityName = 'targitService';
DelayedInsert = true;
SourceTable = "Targit Service Model";
// DelayedInsert = true;
layout
{
area(Content)
{
//SourceTable :=
repeater(GroupName)
{
field(id; "Object ID")
{
Caption = 'Id';
ApplicationArea = All;
}
field(ObjectName; Caption)
{
Caption = 'Object';
ApplicationArea = All;
}
}
}
}
actions
{
area(Processing)
{
action(getall)
{
}
}
}
local procedure Caption(): Text;
VAR
service: Codeunit TargitServiceAction;
Result: Text;
begin
Result := service.GetObjectCaption(rec);
EXIT(Result);
end;
}
- Is there a way to add methods/procedures that can be called in this API page?
- Is it possible to send parameters to this page so i can get the results i want.
- This is necessary because, we want the page to be dynamic so that when we add user defined tables the results can get data as required.
Thanks in advance.