Hi,
Extension development
I'm coding a new action button from the Item List to call a new list form which would have 2 fields: Item No., Extra field (non relevant). Both fields form the primary key on this new page.
When opening this new page, I would expect to have it open prefiltered with the Item No. (which it does), but it doesn't prefill the "item No." field on thew new record. You manually have to key it in, which defeats the purpose of linking the Item record to it.
Here's code snippets:
New page:
Page 50100 "XYZ Item Cross References"
{
Caption = 'Cross References';
PageType = List;
SourceTable = "XYZ Item Cross Reference";
layout
{
area(content)
{
repeater(Control1000000000)
{
field("Item No."; "Item No.")
{
}
field("xyz No."; "xyz No.")
{
}
}
Item List page:
pageextension 50102 "CGI Item List" extends "Item List"
{
layout
{
}
actions
{
addafter("Submittal Cross Ref")
{
action("xyz Omnitracs Cross Ref")
{
Caption = 'xyz Cross Ref';
Image = Change;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
RunObject = page "XYZ Item Cross References";
RunPageLink = "Item No." = field ("No.");
}
}
}
}
Hoping someone can help. Thanks.
0
Answers
First you need a global variable, call it 'LinkedItemNo' type Code[20]
Then, add a trigger to catch the filtered Item No value into this variable
Then, add another trigger to catch when the page creates a new record:
I hate programming the page that way because it's supposed to work just by using the RunPageLink property. The weird thing is that the same thing does work on other pages. I could not figure out why it did not work on one but it did work on another. Anyway, this ended up working for me, hope it helps you. Let me know either way
RIS Plus, LLC
RIS Plus, LLC
I'd prefer to use "TableRelation" property for fields using tableextension instead using pageextension.
> I had the same issue with that, it just would not work the same as it used to in C/AL. I ended up programming the page to automatically set those values.
>
> First you need a global variable, call it 'LinkedItemNo' type Code[20]
>
> Then, add a trigger to catch the filtered Item No value into this variabletrigger OnOpenPage()
begin
if LinkedItemNo = '' then begin
LinkedItemNo := CopyStr(GetFilter("Item No."), 1, 20);
end;
end;
>
>
> Then, add another trigger to catch when the page creates a new record:trigger OnNewRecord(BelowxRec: Boolean)
begin
"Item No." := LinkedItemNo;
end;
>
>
> I hate programming the page that way because it's supposed to work just by using the RunPageLink property. The weird thing is that the same thing does work on other pages. I could not figure out why it did not work on one but it did work on another. Anyway, this ended up working for me, hope it helps you. Let me know either way
I was hoping not having to code when it's supposed to be working off the bat. No choice then. Thank you.
If you want, you can try to reproduce the issue in a standard container and submit it as an issue here: https://github.com/microsoft/AL/issues
RIS Plus, LLC
1. add to the action from which you are calling the other page
2. add to the page which you are opening as this will populate the fields using the filters
you can read more at
RunPageMode = https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-runpagemode-property
PopulateAllFields = https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-populateallfields-property