Adding a new Financial Dimension tab in purchase requisition form in D365 FO

 Adding a new Financial Dimension tab in the purchase requisition form in D365 FO.


 For the Purchase requisition table "Save Data per company" is set No.

So we need to add some extra code. For the Line table in standard they have developed. I took the reference from there.

Step 1: Add dimension field in Table.




Step 2: Add dimension control in the form.


In form init method.

	[ExtensionOf(formStr(PurchReqTable))]
	final class PurchReqTable_Extension
	{
	    public void init()
	    {
	        next init();

	        DimensionEntryControl   fCC = DimensionEntryControl as DimensionEntryControl;

	        fCC.parmValidateBlockedForManualEntry(true);     
	    } 
	}


DataSource Active method.

[FormDataSourceEventHandler(formDataSourceStr(PurchReqTable, PurchReqTable), FormDataSourceEventType::Activated)]
public static void PurchReqTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
    PurchReqTable    		purchReqTable   =   sender.cursor();
    DimensionEntryControl    	fCC 		=   sender.formRun().design().controlName("DimensionEntryControl") as DimensionEntryControl;

    fCC.parmCompany(curExt());
    fCC.reactivate();
}


TabPage Active method:

[FormControlEventHandler(formControlStr(PurchReqTable, HeaderTabFinancialDimensions), FormControlEventType::PageActivated)]
public static void HeaderTabFinancialDimensions_OnPageActivated(FormControl sender, FormControlEventArgs e)
{
    PurchReqTable    		purchReqTable   = sender.formRun().dataSource(FormDataSourcestr(PurchReqTable, purchReqTable)).cursor();
    DimensionEntryControl    	fCC 		= sender.formRun().design().controlName("DimensionEntryControl") as DimensionEntryControl;

    fCC.parmCompany(curExt());
    fCC.reactivate();
}


Output:

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++