2020年2月4日 星期二

Customization on SegmentedEntryControl during on leave any specific segment

Segmented entry control is a form control that you will always see that at general ledger, you will find that there is not enough resource or reference at google talking about work with this form control on D365 FO. 

I have an example here that if you want to do something during on leave any specific segment. This example is simulate there is a customization that need to do something after user inputted value at department of financial dimension at journal voucher.

Create an exntension class of SegmentedEntryControl and create a COC of onSegmentChanged since system will call onSegmentChanged when the cursor is leaving any segment.

[ExtensionOf(classStr(SegmentedEntryControl))]
final class My_SegmentedEntryControl_Extension
{
    public void onSegmentChanged(DimensionControlSegment _segment)
    {
        next onSegmentChanged(_segment);
                
        if(this.formRun().name() == formStr(LedgerJournalTransDaily) && _segment.parmName() == "Department")
        {
            //Do something
        }      
    }

}