Dynamic 365 Business Central : How to extend Activities Cue in Role center Page.
What is CUE?
A Cue provides a visual representation of aggregated business data, like the number of open sales invoices. Cues are interactive, meaning that you can select the Cue to drill down to data or open another page, run code, and more. Cues display data that is contained in a table field. This data can be raw data or calculated data.
Hi Viewer,
To add cue extend Activities Cue(1313) table and Activities (1310) page Extensions.
query 50700 "Open vendor amount"
{
QueryType = Normal;
elements
{
dataitem(VendorLedgerEntry; "Vendor Ledger Entry")
{
column(Remaining_Amt___LCY_LCY; "Remaining Amt. (LCY)")
{
Method = Sum;
}
filter(DocumentTypeFilter; "Document Type")
{
}
filter(Applies_to_ID; "Applies-to ID")
{
}
filter(Open; "Open")
{
}
}
}
}
Create Table extension
tableextension 50706 "Activities Cue Ext" extends "Activities Cue"
{
fields
{
field(50200; "Open Vendor Invoices Sum"; Decimal)
{
Caption = 'Open Vendor Invoices Sum';
DataClassification = ToBeClassified;
AutoFormatExpression = GetAmountFormat();
AutoFormatType = 11;
DecimalPlaces = 0 : 0;
}
}
procedure OpenVendorInvoicesSum() Amount: Decimal
var
VendorLedgerEntry: Record "Vendor Ledger Entry";
Openvendoramount: Query "Open vendor amount";
begin
Openvendoramount.SetRange(DocumentTypeFilter, VendorLedgerEntry."Document Type"::Invoice);
Openvendoramount.SetFilter(Remaining_Amt___LCY_LCY, '<>0');
Openvendoramount.SetFilter(open, 'Yes');
Openvendoramount.SetFilter(Currency_Code, 'USD');
Openvendoramount.SetFilter(Applies_to_ID, ' ');
Openvendoramount.Open();
if Openvendoramount.Read() then
Amount := Amount + Openvendoramount.Remaining_Amt___LCY_LCY;
exit(-Amount);
Openvendoramount.Close();
end;
procedure DrillDownOverduePurchaseInvoiceAmount()
var
[SecurityFiltering(SecurityFilter::Filtered)]
VendorLedgerEntry: Record "Vendor Ledger Entry";
begin
VendorLedgerEntry.SetFilter("Document Type", 'Invoice');
VendorLedgerEntry.SetFilter("Remaining Amt. (LCY)", '<>0');
VendorLedgerEntry.SetFilter(open, 'Yes');
VendorLedgerEntry.SetFilter("Currency Code", 'USD');
VendorLedgerEntry.SetFilter("Applies-to ID", '');
VendorLedgerEntry.Ascending := true;
PAGE.Run(PAGE::"Vendor Ledger Entries", VendorLedgerEntry);
end;
}
Create Page Extensions
pageextension 50711 "O365 Activities Ext" extends "O365 Activities"
{
layout
{
addafter("Overdue Purch. Invoice Amount")
{
field("Open Vendor Invoices Sum"; Rec."Open Vendor Invoices Sum")
{
ApplicationArea = All;
ToolTip = 'Summation of AP/outstanding vendor invoices';
trigger OnDrillDown()
var
myInt: Integer;
begin
rec.DrillDownOverduePurchaseInvoiceAmount();
end;
}
}
}
trigger OnAfterGetRecord()
begin
Rec."Open Vendor Invoices Sum" := Rec.OpenVendorInvoicesSum();
rec.Modify();
end;
}
Comments
Post a Comment