Thursday, November 14, 2019

How to pass the argument from One form to another Form on Button click in D365FO X++

Form 1 on Button Click :
 [FormControlEventHandler(formControlStr(InventItemPrice, KMTItemPriceBreakdownForm), FormControlEventType::Clicked)]
    public static void KMTItemPriceBreakdownForm_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        Args            args = new Args();
        MenuFunction    menuFunction;
 
        InventItemPrice inventItemPrice = sender.formRun().dataSource("ItemPriceActivated").cursor();
        args.record(inventItemPrice);
        menuFunction = new MenuFunction(menuitemDisplayStr(KMTItemPriceBreakdownForm), MenuItemType::Display);
        menuFunction.run(args);



Form 2 on Init:
 [DataSource]
    class KMTInventItemPriceBrkdwn
    {
        public void init()
        {
            super();
            if(element.args().menuItemName() == menuItemDisplayStr(KMTItemPriceBreakdownForm))
            {
                 InventItemPrice kmtinventItemPrice = element.args().record();
                KMTInventItemPriceBrkdwn_ds.query().dataSourceTable(Tablenum(KMTInventItemPriceBrkdwn)).addRange(fieldNum(KMTInventItemPriceBrkdwn,ItemId)).
                    value(SysQuery::value(kmtinventItemPrice.ItemId));
            }
        }
}

3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thanks for sharing the valuable information. It was a great information.
    D365 Finance and Operations Training
    D365 Finance Training
    D365 Operations Training

    ReplyDelete
  3. Playtech launches the 'casinogam' and mobile slots in - JTM Hub
    Playtech 전주 출장안마 has today announced the launch 청주 출장샵 of the first mobile slots and online slot machines 서울특별 출장샵 in Asia, Africa, and 양주 출장샵 South America. 익산 출장안마

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...