Saturday, November 30, 2019

How D365FO debugging really looks like






BTW, jokes aside, where can I see the TTS level during debugging?

Wednesday, November 27, 2019

Enum extensions case in D365

Added two new values to an enum in the same model but in two different extensions.




The first one is looped perfectly (see code snippet below), and nothing but an index for the second. However, its value is present in a combobox.







[ExtensionOf(formStr(SysPolicyParameters))]
final public class mySysPolicyParametersForm_Extension
{
    public void populateTree()
    {
        DictEnum          policyRuleTypeEnum;
        int               i;
        policyRuleTypeEnum = new DictEnum(enumNum(SysPolicyRuleTypeEnum));


        for(i = 0; i < policyRuleTypeEnum.values(); i++)
        {
            str sym = policyRuleTypeEnum.value2Symbol(i);
            info(strFmt("%1 %2 %3", i, policyRuleTypeEnum.value2Name(i), sym));
        }


        next populateTree();
    }
} 
Already built and synchronized the whole world. What else can it be?

Take a look from the SQL side.




There are some old values that I created before but deleted later. All of them are still there.

I had to delete these non-synced values manually from SQL, then added needed values in AOT, and synched DB.

In fact, DB sync is triggered if you have some changes in tables/views only.
Now it is correctly recreated.






BTW there are two good articles about the subject

 1) Extensible enums: Breaking change for .NET libraries that you need to be aware of
 2) Development tutorial: Extensible base enumerations in Microsoft Dynamics AX 7

Wednesday, November 20, 2019

Operating with system defined buttons in form Action pane

Say, we have to reference Edit button.



For this we use the macro #define.SystemDefinedViewEditButton('SystemDefinedViewEditButton')

The whole list is present in SysSystemDefinedButtons macro


Code snippet for your active method in name_DS

int active()
        {
            
            #SysSystemDefinedButtons
 
            ret = super();
 
         < ... >
            FormCommandButtonControl editButton = element.control(element.controlId(#SystemDefinedViewEditButton)) as FormCommandButtonControl;
            editButton.enabled(name_ds.allowEdit());
 
            return ret;
        }

Check this article https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/user-interface/system-defined-buttons

Friday, November 15, 2019

Best Practice in real life: SysPolicy form as a bad example

Walk the talk, guys! It can save a life one beautiful day!



Happy weekend to everyone

Thursday, November 14, 2019

Hidden Rules form part in Policy form

Just discovered that the Policy rules form part is not properly shown in the Policy form.

If you want to get it back, create an extension to SysPolicyListPage and change Part location to Auto





Once it is done, this part will be visible for all kinds of policies, e.g. Purchasing etc.