Sunday, March 5, 2017

AX 2012 : Add/Remove Dynalink through X++

DynaLinks can be removed and added between datasources on form using this code;

ClearDynaLinks() will remove all existing dynaLinks [these can be seen by right click on the click > Personalise > Query tab > under dataSource node

AddDynalink() method has three parameters;


1. Source table field

2. Destination table
3. Destination table field


The following code is implemented in the Click event of a button.

void clicked()
{
    SalesQuotationLine_ds.query().dataSourceNo(1).clearDynalinks();
    SalesQuotationLine_ds.query().dataSourceNo(1).addDynalink(fieldNum(SalesQuotationLine, QuotationId),
                                                         SAB_DocQuoteGroupRelation,
                                                         fieldNum(SAB_DocQuoteGroupRelation,SalesQuotationId));
        
}

1 comment:

  1. Hi Faisal,
    Would you explain it to me which one is Parent table and which one is Child table?

    ReplyDelete

I will appreciate your comments !

Download large bacpac (sandbox database) to DEV environment much faster

As the LCS website gets slower and slower and the database backups get bigger and bigger.  Use AZCopy to download objects out of LCS asset l...