Thursday 6 December 2018

Enable FormControl using Event Handler in AX 7 / D365 Finance & Operations

Create Event Handler with below code


[PostHandlerFor(formStr(DirPartyCheckDuplicate), formMethodStr(DirPartyCheckDuplicate, enableSearch))]
    public static void DirPartyCheckDuplicate_Post_enableSearch(XppPrePostArgs args)
    {
        FormRun formRun = args.getThis() as FormRun;
        FormCheckBoxControl TaxId       = formRun.design(0).controlName("TaxId") as FormCheckBoxControl;
        FormStringControl PartyNumber   = formRun.design(0).controlName("DirPartyTable_PartyNumber") as FormStringControl;
        FormComboBoxControl TaxIdType   = formRun.design(0).controlName("TaxIdType") as FormComboBoxControl;
        FormControl searchBtn           = formRun.design(0).controlName("searchBtn");
        

        if(TaxId.value() ||
            PartyNumber.valueStr() ||
            TaxIdType.valueStr())
        {
            searchBtn.enabled(true);
        }
        else
        {
            searchBtn.enabled(false);
        }
        
    }

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...