RSS

Tag Archives: X++

What are the differences between addOrderByField and addSortField


With addSortField you can set “only” the records order.

With AddOrderByField you can build some logic because is used the kernel class QueryOrderByField.

So, you can use the follow methods :
– direction
– autoHeader
– autoHeaderDetailLevel
– autoSum
– autoSumDetailLevel
– datasource
– fieldId

You can find some examples on the standard class :

– DimensionProvider Class, getDimensionOrderBysFromQuery method
– InventDimCtrl_Frm_OnHand class, modifyQuery method

 
Leave a comment

Posted by on June 12, 2015 in AX 2012, X++

 

Tags: ,

How to get Label Id from a text


If you want retrieve the Label ID from a specific text description, here the code.
If are present more Label ID for a specific text, you will have the first.

sysLabelEdit     sysLabelEdit = New sysLabelEdit();
labelid          labelid;
str              text = “Customer account”;
str              specialCharsText;

specialCharsText = SysLabel::searchStringBuildSpecialCharString(text);
specialCharsText = SysLabel::seachStringBuildExactStr(specialCharsText);

labelid = sysLabelEdit.findLabel(“en-us”, specialCharsText);

info ( labelid );

 
Leave a comment

Posted by on June 12, 2015 in X++

 

Tags:

Cascade+Restricted Concept in Ax 2012Ax


Step 1:
Create 3 tables for an example :

Table 1- SheetTable, with Two fields Sheetid and sheetname
Table 2-PartitionTable with three fields sheetid , partitionid and sheetsize
Table 3-SheetPartitionTable with two fields partitionid and Shape 

Step 2:

1) Create a relationship between SheetTable and PartitionTable (Ex:PartitionTable.SheetID==SheetTable.SheetId) 

2) Create a relationship between PartitionTable and SheetPartitionTable(EX:SheetPartitionTable.PartitionID==PartitionTable.PartitionID)

Step 3:

1) Create Cascade DeleteAction between SheetTable and PartitionTable

2) Create Cascade+Restricted DeleteAction between PartitionTable and SheetPartitionTable

Step 4:
Open SheetTable and delete the matched record with PartitionTable.

Automatically the matched record from SheetTable , PartititonTable and SheetPartitionTable will be deleted .

 
Leave a comment

Posted by on June 10, 2015 in AX 2012, X++

 

Tags: ,

Get the phone number of the Delivery Address in the Purchase Order


static void getphoneNumber(Args _args)
{
PurchTable purchTable;
LogisticsLocation logisticslocation;
LogisticsPostalAddress logisticsPostalAddress;
select purchTable where purchTable.PurchId==”P000059″;
select logisticslocation where logisticslocation.ParentLocation ==
LogisticsPostalAddress::findRecId(purchTable.DeliveryPostalAddress).Location;
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Description);
info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Locator);
}
 
Leave a comment

Posted by on June 10, 2015 in AX 2012, X++

 

Tags: ,

Validate the Special Characters from the given String in Ax 2012


X++ code to validate the special characters from the given string

static void RemoveSpecialCharacters(Args _args)
{str stringVar1,stringVar2;

//String with special characters and numbers
stringVar1= test!@#$%^&*(){}[]|\+-;,.?/~`12344;

//String without Special characters and  numbers
stringVar2=strRem(strAlpha(stringVar1),”1234567890″);

if(stringVar2!=stringVar1 )
{          throw error(“Enter Valid data”);
}else
{            info(“ok”);
}
}

 
Leave a comment

Posted by on June 10, 2015 in AX 2012, X++

 

Tags: ,

Add contact information for entity



How you can add contact information data to an existing entry in the global address book.

static void createPartyContactInfo(Args _args)
{
DirPartyTable dirPartyTable = DirPartyTable::findByNum(‪‪”100000″);
DirParty dirParty;
DirPartyContactInfoView dirPartyContactInfoView;

// Edit Global address book
dirParty = DirParty::constructFromCommon(dirPartyTable, DirUtility::getCurrentDateTime(), DirPartyType::Organization);

// Create contact info
dirPartyContactInfoView.LocationName =’Office’;
dirPartyContactInfoView.Locator =’+43 1 4654646′;
dirPartyContactInfoView.Type = LogisticsElectronicAddressMethodType::Phone;
dirPartyContactInfoView.IsPrimary = NoYes::Yes;

dirParty.createOrUpdateContactInfo(dirPartyContactInfoView);

}

 
Leave a comment

Posted by on May 26, 2015 in AX 2012, X++

 

Tags: ,

Create primary address through code


The following lines show an example of how you can create a (primary) address for an existing party in the global address book by x ++ code.

The address will only be marked as primary , if no other primary address exists for this party!

static void createPartyAddress(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 = “Office”;
dirPartyPostalAddressView.City = “Vienna”;
dirPartyPostalAddressView.Street = “Kärtnerring”;
dirPartyPostalAddressView.StreetNumber = “18”;
dirPartyPostalAddressView.CountryRegionId = “AUT”;
dirPartyPostalAddressView.IsPrimary = NoYes::Yes;

dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
}

 
Leave a comment

Posted by on May 26, 2015 in AX 2012, X++

 

Tags: ,

Post sales invoice through code


Those, who want to have more control over the data to be posted, should take a look at the parameters of salesFormLetter.update().

static void postSalesInvoice(Args _args)
{
SalesTable salesTable = SalesTable::find(“000747”);
SalesFormLetter salesFormLetter;

salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All);
}

 
Leave a comment

Posted by on May 26, 2015 in AX 2012, X++

 

Tags: ,

Post sales order confirmation through code


Those, who want to have more control over the data to be posted, should take a look at the parameters of salesFormLetter.update().

static void postSalesConfirmation(Args _args)
{
SalesTable salesTable = SalesTable::find(“000747”);
SalesFormLetter salesFormLetter;

salesFormLetter = SalesFormLetter::construct(DocumentStatus::Confirmation);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All);
}

 
Leave a comment

Posted by on May 26, 2015 in AX 2012, X++

 

Tags: ,

Post sales packing slip through code


Those, who want to have more control over the data to be posted, should take a look at the parameters of salesFormLetter.update().

static void postSalesPackingslip(Args _args)
{
SalesTable salesTable = SalesTable::find(“000747”);
SalesFormLetter salesFormLetter;

salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All);
}

 
Leave a comment

Posted by on May 26, 2015 in AX 2012, X++

 

Tags: ,

 
Dynamics Cognizance

Site presents solution to common and non-common Microsoft Dynamics Ax problems faced by Consultants and Administrators

365 by Thijs

Blogging about Microsoft 365, Azure and Automation!

axhowto

Blog about ax with sample codes, tips and tricks.

GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations

DynaD365Power

Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching

ErpCoder

Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX

“ANYONE WHO STOPS LEARNING IS OLD, WHETHER AT TWENTY OR EIGHTY.” —HENRY FORD

Sumit Potbhare

Dynamics 365 for Commerce

iotsolution.se

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens