Dynamics AX Blog - Posts from September 2015

These posts are machine-translated.
Currently, only posts from »September 2015« are displayed Filter entfernen

How to create a non-primary address in global adressbook

Example of how you can create a non-primary address for an entry in the global address book via code.

static void createPartyAddressNonPrimary(Args _args)
{
    DirPartyTable dirPartyTable = DirPartyTable::findByNum("???100000??");
    DirParty dirParty;
    DirPartyPostalAddressView dirPartyPostalAddressView;

    // Create instance of dirParty
    dirParty = DirParty::constructFromCommon(dirPartyTable, DirUtility::getCurrentDateTime(), dirPartyTable.partyType());

    // Create primary address
    dirPartyPostalAddressView.LocationName      = "Delivery";
    dirPartyPostalAddressView.City              = "Vienna";
    dirPartyPostalAddressView.Street            = "Kärtnerring";
    dirPartyPostalAddressView.StreetNumber      = "21";
    dirPartyPostalAddressView.CountryRegionId   = "AUT";
    dirPartyPostalAddressView.IsPrimary         = NoYes::No;

    dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
}

 
 
 

Open query window when opening form

To open the query-windows when opening a form, you can use the following code for example:

public void run()
{
    super();
    if(dataSourceName_ds.queryRun().prompt())
    {
        dataSourceName_ds.research();
    }
}

 


 
 
 

Cancel salesline through code

The code is based on the logic in the form SalesUpdateRemain ("Deliver remainder" button in the sales order header).

static void cancelSalesLine(Args _args)
{
    boolean updated;
    SalesLine salesLine; 
    
    try
    {
        ttsBegin;        
        
        salesLine = SalesLine::findInventTransId('012411', true);
    
        updated = SalesUpdateRemain::updateDeliveryRemainder(salesLine, 0, 0);
    
        if(updated)
        {
            info("Salesline canceled");    
        }        
        
        ttsCommit;
    }
    catch
    {
        error("SalesLine could not be canceled");
    }
}

 
 
 

 

 
 
 
Posts of the actual month
September 2015
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
282930 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.