D365F&O - X++ - create button onclicked eventhandler on form extension

[FormControlEventHandler(formControlStr(CostingVersion, CalcInMass), FormControlEventType::Clicked)]
public static void CalcInMass_OnClicked(FormControl sender, FormControlEventArgs e)
{
    FormDataSource  formDatasource;
    BOMCalcJob_All  BOMCalcJob_All;
    CostingVersion      CostingVersion;

    formDatasource = sender.formRun().dataSource(1);
    CostingVersion = formDatasource.cursor();
    BOMCalcJob_All = BOMCalcJob_All::newAll(CostingVersion);
   
    if (BOMCalcJob_All.prompt())
    {
        BOMCalcJob_All.modifyQuery();
        BOMCalcJob_All.run();
    }
}

Comments

Popular posts from this blog

D365F&O - X++ - Best Practice Warning BP Rule: [BPErrorUnknownLabel]: Path:

D365F&O - X++ - How to Enable/Disable button on form based on a condition in D365F&O using Event handlers.

D365FO - X++ - Generate CAR (Customized Analysis Report) report of custom model