Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Tuesday, March 9, 2021

Extend / Customize standard CanSubmitToWorkflow in D365

Hi,


We cant override CanSubmitToWorkflow to return our boolean on any eventHandler's return like eventHandler of ValideWrite(). To achiew we have to set the args of CanSubmitToWorkflow() to be decided by our code.

[PostHandlerFor(formStr(CustTable), formMethodStr(CustTable, canSubmitToWorkflow))]

    public static void CustTable_Post_canSubmitToWorkflow(XppPrePostArgs args)

    {

        FormRun     form = args.getThis();

        FormDataSource      custTable_ds = form.dataSource(formDataSourceStr(custTable,CustTable)) as FormDataSource;

        custTable           custTable    = custTable_ds.cursor();

        if (custTable.RecId && custTable.DocumentStatus == DocumentStatus::NotSubmitted)

        {

            args.setReturnValue(true);       

        }

        else

        {

            args.setReturnValue(false);

        }

    }


Regards,

Monday, February 22, 2021

How to achieve table relation in SQL without primary index 1:n

HI,

Select particular parent table (master table) db.table.
1. Right click select design

2. Select the respective field where we have to achieve unique index but not primary.
Right click on that filed select Indexs/keys...



3. Add the select the column to from that list and please make sure you change the property to YES in isUnique.


4. Save and select the design of transaction table where we try to achive Foreign key.
Right click on that particular filed and choose Relationships..


5. Add the relationship by select the tables and columns specifics.




Regards,

 

How to invoke and iterate List as Contract methods in AX 2012/ D365

Hi, Public void performContractIterate(ClassContainsListAsContract    _ListCarryClass) { List contractFieldList = new List(Types::Class); ...