Enable Modified by and Created by on ALL Parameters tables

0

Handy Code to have , Can be use to change any of the property of a table also just with the slightest change.

 

static void Waj_EnableProperties(Args _args)

{

SysDictTable dictTable,sysDictTable;
TreeNode node;
#AOT Name name;
TreeNode treeNode;
str indexName;
#Properties
;

treeNode = TreeNode::findNode(#TablesPath);
treeNode = treeNode.AOTfirstChild();

while (treeNode)

{
name = treeNode.AOTname();
sysDictTable = SysDictTable::newTableId(treeNode.applObjectId());

if ((sysDictTable.tableGroup() == tableGroup::Parameter ||
sysDictTable.tableGroup() == tableGroup::Group) &&
!sysDictTable.isMap() &&
!sysDictTable.isTmp() &&
!sysDictTable.isView() &&
sysDictTable.enabled())
{

node = SysDictTable.treeNode();
node.AOTsetProperty(#PropertyCreatedBy, #PropertyValueYes);

node.AOTsetProperty(#PropertyCreatedDateTime, #PropertyValueYes);
node.AOTsetProperty(#PropertyModifiedBy, #PropertyValueYes);
node.AOTsetProperty(#PropertyModifiedDateTime, #PropertyValueYes);

node.AOTsave();

node.treeNodeRelease();
node = null;

}

}

}

Create Ledger dimension from string values

0

1 – By using the below code one can create ledger dimesion recId using X++
Combination of Main Account and DimensionValue

container offsetAccount;

RefRecId ledgerDimension;

offsetAccount = [‘11850000’, ‘11850000’, 3, ‘Department’, ‘101’, ‘Customer’,‘Cus-101’, ‘Vendor’, ‘Vend-101’];
//[MainAccount,MainAccount, NoOfDimensions, DimensionName, value]

ledgerDimension = AxdDimensionUtil::getLedgerAccountId(offsetAccount);

2 – Create Ledger dimension from main account (default account) and default dimension

The DimensionDefaultingService::serviceCreateLedgerDimension() method can be used to create ledger dimension from main account and default dimension.

JournalTrans.LedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(_defaultAccount,
JournalTrans.DefaultDimension);

Create Default dimension using x++

0

The following job will get a DimensionAttributeValueSet record ID base on the a set of dimension values.

 

static void CreateDefaultDimensions(Args _args)
{
PurchTable purchTable;
DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
DimensionDefault result;

int i;
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue;

// Note that “Item” is not one of the default dimension,
// but DimensionAttributeValueSetStorage will handle it gracefully
container conAttr = [“Project”, “Vendor”]; // Dimensions
container conValue = [“1001”, “Ven-0046”]; //  respective Values
str dimValue;

purchTable = purchTable::find(‘000471’);

for (i = 1; i <= conLen(conAttr); i++)
{
dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));

if (dimensionAttribute.RecId == 0)
{
continue;
}

dimValue = conPeek(conValue,i);

if (dimValue != “”)
{
// The last parameter is “true”. A dimensionAttributeValue record will be created if not found.
dimensionAttributeValue =
dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);

// Add the dimensionAttibuteValue to the default dimension
valueSetStorage.addItem(dimensionAttributeValue);
}
}

result = valueSetStorage.save();
purchTable.selectForUpdate(true);
ttsBegin;
purchTable.DefaultDimension = result;
purchTable.doUpdate();
ttsCommit;
}

Get Comments of a Workflow

0

We can use this sample code to get the workflow comments on particular Record. Project budget is my desired table  . you can replace ProjBudget to any other table on which you want to get the entered comments.

workflowcomment

while select WORKFLOWTRACKINGSTATUSTABLE where WORKFLOWTRACKINGSTATUSTABLE.ContextRecId == projBudget.RecId  //
&& WORKFLOWTRACKINGSTATUSTABLE.ContextTableId == tableNum(ProjBudget)
{

while select WORKFLOWTRACKINGTABLE where WORKFLOWTRACKINGTABLE.WorkflowTrackingStatusTable == WORKFLOWTRACKINGSTATUSTABLE.RecId
{
while select WORKFLOWTRACKINGCOMMENTTABLE
where WORKFLOWTRACKINGCOMMENTTABLE.WorkflowTrackingTable == WORKFLOWTRACKINGTABLE.RecId

{

}

}

Go to origin \ Custom button on Info

0

Just a quick code to add a button on InfoLog to facilitate user to go directly on the respective message record.

OutPut: 

rfq-img

 

Code :

img-2

 

SysInfoAction_MenuFunction        sysInfoAction; //Class which we have to use to create a Button.
purchRFQCaseTable       purchRFQCaseTable; // Declaration of buffer
purchRFQCaseTable = purchRFQCaseTable::find(‘RFQ-0001’);

sysInfoAction = SysInfoAction_MenuFunction::newMenuItem(menuitemDisplayStr(PurchRFQCaseTable),MenuItemType::Display); // here we create a button Link with the menu Item of the form to open on click event
sysInfoAction.parmCallerBuffer(purchRFQCaseTable); //passing buffer on the form
info (strfmt(“@SYS107925″, purchRFQCaseTable.rfqCaseId),”, sysInfoAction); // creating info with desired button

 

 

 

Process Industries Add-On for Microsoft Dynamics AX 2009

0

Recently  I got a requirement to install PI 2009 on one of my client. What I figured is the sequence of installation is very important

Here are the steps to follow:

1. Install AX2009 RTM (SYS layer)
2. Install SP1 (SYP layer)
3. Install GLS layer if needed
4. Install Process Industries 5.1.3.1 (BUS layer (compatible with existing GLS))
5. Install RU7 (SYP (+ GLP layer))
6. Install PI BUP layer (specific to localization)
7. Open AX client and run Installation Checklist

 

BUP layers Installation file Download link is here

 

Hope this will save Some on time 🙂

 

Technical Concepts in New Dynamics AX – AX7

0

Today I will discuss two methods of customizing new Dynamics AX source code of model elements which are: over layering and extensions.

Extensions:

A new way of customization has been introduced by Microsoft by using extensions. An Extension is a brand new AX object that references an existing object. This style of development allows existing objects to be customized without directly touching the original object. It is a useful concept for future application updates as upgrades will become much simpler by reducing the number of dependencies.

Example:

Taking example from my recent scenario, where I have to add my Recruitment and leavers reports menu items into HRM module in order to be accessible for end users. Now see how things are working differently here that Instead of directly touching the existing menu, a new object is created that references the existing HRM menu. The AX compiler magically merger both HRM and HRM extended with newly added menu items.

Extensions

What is great about this approach is that there is distinct ownership of each object. Microsoft owns the HRM Menu, while an ISV, Partner, or Customer owns the HRM extended menu. Each party can make changes to their object without impacting the other.

Menus are one area for extensions, but there are quite a few objects types eligible for extension.

  • Tables
  • Data entities
  • Forms
  • Menus
  • Security
  • Some Enums
  • X++ Code (Events)

We are hoping to see more in future from Microsoft as they continues to evolve the extension story and support more scenarios.

Over Layering

Another way of doing customization in source code and metadata model elements that are shipped by Microsoft or third-party partners in Microsoft Dynamics AX, the developer must create a new model that overlays the model they want to customize. For example, solution developers can provide code in the SLN layer, independent software vendors can use the ISV layer, and value-added resellers can use the VAR layer. Functionality defined in higher layers (VAR layer in this example) can override the functionality of lower layers.

The overlaying model must belong to the same Package as the source model and must belong to a layer that is higher than the source model. Over layering is a powerful tool to perform advanced customizations of metadata and source code, but may increase the cost of upgrading a Dynamics AX solution to a new version.

You can create a new model by going in visual studio -> Microsoft Dynamics – > Model management – > create new model

Model

 

The below picture will help in understand both:

Extensions-vs-overlaying

 

That’s it for now, I will cover more in depth including Packages. Extensions. Layers. Models in future blogs.

 

Happy Daxing :)