Enable / disable controller on D365 FO


       int controlId	 = form.controlId("SalesLine_RefrenceCost");
        FormRealControl callerControl = form.control(controlId);

        FormDataSource	SalesLine_ds = form.dataSource("SalesLine");
        SalesLine       _salesLine = SalesLine_ds.cursor();

        select _purchLine
            where _purchLine.PurchId == _salesLine.RelateInventTransId
            && _purchLine.InventTransId == _salesLine.RelateInventRefTransId
            && _purchLine.ItemRefType == InventRefType::Sales;
        
        if(_purchLine)
            callerControl.enabled(false);
        else
            callerControl.enabled(true);

Leave Comment

Your email address will not be published. Required fields are marked *