Showing posts with label development practice.. Show all posts
Showing posts with label development practice.. Show all posts

December 08, 2022

QuickFix: Visual studio run as admin by default

Hi Folks, 

If you just rolled out a new DEV VM and using VS for first time OR even you are using any VM for development, you must aware that Visual studio should run as admin to use for development. You may not be able to do all the things without Admin run. 

Now here I am sharing a quick tip to run VS as admin by default.
1. Click on window icon and search 'devenv'
























2. Right click on this and 'Open file location'
3. Copy shortcut from here and paste on desktop.
4. Now you got this shortcut on your desktop, right click on this and click property > Advance
5. Here select 'Run as administrator'' check box. and click on ok/apply. 



















That's it. Now the desktop shortcut will always run as admin. 


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

August 18, 2019

How to increase font size in BizTalk schema/Map editor

Hi Folk,

Now when Logic apps are all over around the integration of D365FO, I am sure you have seen BizTalk editor once in a while. The default editor's font size is so small, you may need a magnifier glass. And I really mean it.

I searched for some solution around the web but didn't found much of the help. Well, here I am sharing my finding with the possible solution or I would say most suitable solution as of now.

Here is a screenshot of the default font size.



To fix this issue, Go to

Setting > Display setting > Advance Display setting > Advance Sizing of text and other Items

Above navigate should give you below screen





















here click on 'set a custom scaling level'. and set the scale to 300%

























Once you have done this, re-login into the system and see the changes. Below is the new appearance of the same map.









































For more details on BizTalk check below link,

https://docs.microsoft.com/en-us/biztalk/core/using-biztalk-editor

Cheers!!!
-Harry
 Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

July 19, 2019

Object compare in #MSD365FO

How to compare an AOT object in D365FO.

If you received a project export (.axpp file) and you want to see what's the changes between this file and your current code. While importing this project (from Dynamic 365 menu in VS), right-click on the object and you will get the option to compare this object from your current metadata.





















It will open a compare window




















where
1 is a model store or your current metadata.
2 is Target file or file from import project
3 is a menu bar with 'Next', 'Previous', 'Expand all' and 'compare code' options.


when you click on 'compare code' option it will open this compare file in the visual studio itself, similar to other compare option.






















-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

September 09, 2018

Form Event handler methods in Dynamics 365 FO

Hi Guys,

Let’s discuss today the different event handlers in Dynamics 365 FO. Now we don't have the leverage 😉to overwrite existing code anymore so all you have is event handlers to manipulate standard functionality. However, event handlers were available in the earlier version as an optional and best practice but now it’s the only option. I will be sharing different event handler so we can cover most of the methods with different parameters.


1. Form dataSource event handler: Here I will be using the vendTable form to get table buffer and perform additional business logic or validation.

Vendtable = Form name
vendTable = form data source name
[FormDataSourceEventHandler(formDataSourceStr(Vendtable, vendTable), FormDataSourceEventType::Written)]
public static void vendTable_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
{
    FormRun                 form           = sender.formRun();
    FormDataSource          vendTable_ds =       form.dataSource(formDataSourceStr(Vendtable,Vendtable)) as FormDataSource;
   Vendtable     Vendtable= vendTable_ds.cursor();
<Now to got table buffer, perform business logic/validation>
}
lets see one more example below;

2. Form DataSource while closing the form (same will apply for OnInitialized,
[FormEventHandler(formStr(EcoResAttributeValue), FormEventType::Closing)]
public static void EcoResAttributeValue_OnClosing(xFormRun sender, FormEventArgs e)
{
     FormDataSource ecoResProduct_ds   =          sender.dataSource(formDataSourceStr(EcoResAttributeValue, EcoResProductAttributeValue));
      EcoResProductAttributeValue      ecoResAttributeValue = ecoResProduct_ds.cursor();
<YOUR CODE>
}   

3.  Post-event hander of Form init or any other standard method method
[[PostHandlerFor(formStr(Ledger), formMethodStr(Ledger, init))]
    public static void Ledger_Post_init(XppPrePostArgs _args)
    {
        #ISOCountryRegionCodes
        FormRun form = _args.getThis();
        FormDesign design = form.design();
        FormControl revaluationAccount = design.controlName(formControlStr(Ledger, revaluationAccount));
        FormControl currencyRevaluation = design.controlName(formControlStr(Ledger, currencyRevaluation));

<your code>
}

4. Form control event hander:
[FormControlEventHandler(formControlStr(LogisticsPostalAddress, Roles), FormControlEventType::Modified)]
    public static void Roles_OnModified(FormControl sender, FormControlEventArgs e)
    {
        FormRun element = sender.formRun();
        FormControl purposeCtrl   = element.design().controlName(formControlStr(LogisticsPostalAddress, Roles));
       
        FormDataSource logisticsLocation_DS = element.dataSource(formDataSourceStr(LogisticsPostalAddress, LogisticsLocation));
       <business logic>
    }


Cheers,

Harry
Follow us on Facebook to keep in rhythm with us. @Facebook

February 09, 2018

Mobile app development in D365 for FO- Part II

Hi Folks,

In my last post, Mobile app development in D365 for FO - Part I, we discussed how to create a simple workspace for the mobile platform. In today's post, I will share some of the deployment methods for mobile workspace.

In the current version of the mobile app, we can create two types of workspaces that are available to deployment.

a. In database
b. In metadata

a. Database workspaces:
When a user builds an app workspace using web API, it will have stored in the database and anyone can edit or delete such pages.

Database pages easy to create with navigation only. Mobile app framework will record user action and convert into logic, pages actually work the same as a user will record for it. It’s important that the user has clear visibility of what user requirements before creating a page or action.
There are three sections in mobile workspace

i. Pages: Pages that will appear in the mobile workspace, to display data.
ii. Action: To perform CRUD operations.
iii. Logic: Attach the JS file.

Current mobile app framework is flexible in terms of designing flow, the user must be very careful how the user is recording the business process while configuration.

b. Metadata workspace

These pages need to be developed using classes in VS. Metadata workspaces cannot be created directly in VS, firstly user needs to create a workspace in user database using the above method and then attached user workspace to it.


-Harry Follow us on Facebook to keep in rhythm with us. @theaxapta

November 23, 2017

How to Delete a model in Dynamics 365 for FO


I was trying for this for very long time, on initial stage of development it was one of the biggest headache for me. HOW TO DELTE A MODEL. So now finally I come to conclusion on this.

Note: I would recommend check with all other developer who is sharing the same dev machine before deleting this to make nothing will go wrong. Take a backup of your code.

Prerequisite:
1.     Login to server using admin credentials
2.     Check your model directory it must be sore under below path/folder
C:\AOSService\PackagesLocalDirectory/<your model>





There can be two scenarios here,
1.     Model belongs to its own package
2.     Model belongs to standard (existing) package.

1.     If your model belongs to its own package (For example: An extension package with no other models in the package):
a.      Stop the following services: The AOS web service and the Batch Management Service
b.     Delete the package folder C:\AOSService\PackagesLocalDirectory\<your model>
c.      Restart the services from step 1
d.     If Visual Studio is running, refresh your models (Visual Studio > Dynamics 365 > Model management > Refresh models)
e.      In Visual Studio, perform a full database synchronization (Visual Studio > Dynamics 365 > Synchronize database...)





2.     If your model belongs to a package with multiple models (For example, <your model> overlays Application Suite):
a.      Stop the following services: The AOS web service and the Batch Management Service
b.     Delete the model folder C:\AOSService\PackagesLocalDirectory<PackageName>\<your model> (In this example PackageName=ApplicationSuite)
c.      Restart the services from step 1
d.     In Visual Studio, refresh your models (Visual Studio > Dynamics 365 > Model management > Refresh models)
e.      In Visual Studio, build the package that the deleted models belonged to (Visual Studio > Dynamics 365 > Build models...)
f.       In Visual Studio, perform a full database synchronization (Visual Studio > Dynamics 365 > Synchronize database...)


Enjoy..
Harry.

Disc: This post is referred from here.


October 17, 2013

Method Modifiers Supported by X++

 Method Modifiers Supported by X++


Method Modifiers Supported by X++
Modifier
Description
static
Static methods are accessed via class declarations. Fields can’t be accessed from within a static method.
final
Final methods can’t be overridden by methods with the same name in derived classes.
abstract
Abstract methods have no implementation. Derived classes must provide definitions for abstract methods.
server
Server methods can execute only on an Application Object Server. The server modifier is allowed only on static methods.
client
Client methods can execute only on a MorphX client. The clientmodifiers are allowed only on static methods.
display
Display methods are invoked each time a form or report is redrawn. The display modifier is allowed only on table, form, form data, report, and report design methods.
edit
The edit method is invoked each time a form is redrawn or a user provides input through a form control. The edit modifier is allowed only on table, form, and form data source methods.


For More Details on the same check below link

September 07, 2013

Method Types in Dynamics AX Classes


Method Types in Dynamics AX Classes

There are many different types of methods. Some of the more common types are
1. Static Methods
2. Main Method
3. Display Methods
4. Accessor Methods

1. Static Methods

Static methods are attached to a class. However, they do not need that class to be instantiated to execute that method. They are not within the scope of the class, so any class variables are not available in a static method.
Static methods are declared static by using the Static method modifier.
Static methods are called using the class name followed by two colons (::) and then the methods name.
The following example shows a static method declaration, and a call to that static method.

static public void myStaticMethod()
{
}
myClass::myStaticMethod()

2. Main Method

The main method is a static method that can be used to call a constuctor. It is special because its name is required to be "main". It is used by the system when the class is run directly from a menu item and it takes a parameter of type args. 
Args is a class that is used to pass parameters between objects, for instance, various parameters can be set on the properties on a menu item. When the menu item calls a class, the args class containing those property values is passed to the main method using the args parameter.

3. Display Methods

Display methods are used on forms. They are commonly created on the table, and can also be defined on the form. Display methods return a value that is displayed on the form or report. They are often used to display a calculation, or to look up a single field from another table. 
The following example shows how to display the item name on a form that displays data from a table containing the item id.

// BP Deviation documented
display itemName itemName()
{
inventTable inventTable
select name from inventTable
where inventTable.itemId == this.itemId;
return inventTable.name;
}

The first line in this code is a comment to the compiler indicating that a Best
Practice deviation is considered and evaluated as reasonable. The deviation is
because a display method is able to return any data from any table or field in the system, and so the security implications should be considered.

4. Accessor Methods

Accessor methods enable other elements to set or get the values of variables in a class and it is common that they do both. The following example accepts a value as a parameter, sets a class variable to this value and then returns the value. The parameter has a default value set to the class variable value, so if the method is called without a parameter, it returns the value of the class variable. If it is called with a value in the parameter, then the
class variable is set to this value.

public str myName(str _myName = myName)
{
myName = _myName;
return myName;
}

-Harry

August 03, 2013

Create Progress bars in Dynamics AX

 Create Progress bars in Dynamics AX [startlengthyoperation, SysOperationProgress,Animations ]

Progress bars are inbuilt in runbase frameworks. We can Use a progress indicator during operations that take more than 2 seconds 
OR
Use an hourglass mouse pointer if the process takes 2-7 seconds.
OR

Use a progress bar if the process takes 8 seconds or more.

There are many ways to display operations in progress
1) Hourglass Indicators
2) Progress Bars
3) Progress controls on the forms
4) Animate Controls


Hour Glass Indicators Example:

Use startlengthyoperation() and endlengthyoperation() between ur business logic
Example :


static void HourGlassMousePointer(Args _args)
{
int i;
str value;
;

startLengthyOperation();
for( i = 1; i <= 10000; i++)
{
value += int2str(i) + ','; // some business logic
}


endLengthyOperation();
}

Below is how the hourglass indicator looks



Use SysOperationProgress class to show the progress Bars
Initialize a SysOperationProgress variable.
Set a caption for the form by using the SysOperationProgress.setCaption method.
Set an animation to run while the operation is in progress by using the SysOperationProgress.setAnimation method.
A number of animations are provided with Microsoft Dynamics AX. To view them, run the Tutorial_ShowAVIFiles class. If you use one of these animation files, you need to declare the AviFiles macro at the top of your code.
Specify the total number of operation steps.
This is needed for the time-remaining calculation. If you do not set the total number of operation steps, the progress indicator is not shown. The total is often a count of the number of records, and may be time-consuming to calculate. Don't specify the total if the time is taken to calculate the records is comparable to the total time taken for the operation.

Perform the operation. For each step, specify a description and a step number.
During the execution, the progress indicator is updated accordingly. The estimated time remaining is calculated and displayed.
The default update interval is 3 seconds. If the task of updating the display takes more than 10% of the update interval due to latency on the network connection, the update interval is increased by 1 second.

Example :


static void operationProgress_progressBars(Args _args)
{
#AviFiles
SysOperationProgress progress = new SysOperationProgress();
int i;

;

progress.setCaption("Progress bar example…");
progress.setAnimation(#AviUpdate);
progress.setTotal(10000);
for (i = 1; i <= 10000; i++)
{
progress.setText(strfmt("The value of i is %1", i));
progress.setCount(i, 1);
}
}

Below is the output:
Use progress control on the form:
Create a new progress control and change the autodeclaration property of the progress control to yes as shown in the figure.

In the init() or run() method of the form modify the code as shown below.





SysDictClass dictClass;
int i;
int classCount;
classId classId;
Dictionary dictionary;
;
super();
dictionary = new Dictionary();
classCount = dictionary.classCnt();

progress.rangeLo(1);
progress.rangeHi(classCount);
progress.pos(1);
progress.step(1);



for (i=1; i <= classCount; i++)
{
progress.pos(i);
dictClass = new SysDictClass(dictionary.classCnt2Id(i));
info(dictClass.name());
}


Finally Animations: we can use Animations to let the end users know that process is running at the back ground.
We can use Animate controls to show the progress. Create a new form and add a animate control as shown below. Change the autoDeclaration property of the animate control to Yes


Override the run() method and paste the below code
public void run()
{
int i;
#AviFiles
;
super();
for (i = 1 ; i <= 10000; i ++)
{
Animate.animateFile(#AviPrint);
Animate.play(); // autoplay(true);
}


Animate.visible(false);
}

Below is the output



-Harry

June 17, 2013

Use resource files in Axapta

Use resource files in Axapta

In Application Object Tree, you can find resources node.
Select resources node and right click; select Create from File, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your local/server system.

First, pick up the resource node from AOT;


SysResource::getResourceNode();

Then generate a temporary file for this resource file;

SysResource::saveToTempFile()

Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of  a given form.

{
ResourceNode            resourceNode;
FilePath  imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(ResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file exists.”)
}

element.design().imageName(imagename);
}

You can try This also
Add a resource file in Resource node under AOT, Right click on Resource Node -> select "Create From File"



Select a file  from your your local drive.



 You can change the label and name of this file as require.














To use this image file in your code just add following code 

SysResource::getResourceNodeData(SysResource::getResourceNode('theaxapta_File'));

Enjoy.......

-Harry

June 04, 2013

Finding AOT object by its propery

Finding AOT object by its propery

In Dynamics AX we can find all the AOT objects by specifying some property. Lets say we want to find all the tables in AOT having "SaveDataPerCompany" property set to No.
We can use the following x++ job
The X++ job below shows how to find all tables in the AOT where the SaveDataPerCompany property is set to No.


static void findAOTObjectByProperty(Args _args)
{
#AOT
TreeNode treeNodeTables = TreeNode::findNode(#TablesPath);
TreeNode treeNode;
str strPropertyName = 'SaveDataPerCompany';
str strPropertyValue = 'No';
;
// first table
treeNode = treeNodeTables.AOTfirstChild();
while (treeNode != null)
{
if (treeNode.AOTgetProperty(strPropertyName)== strPropertyValue)
{
info(treeNode.AOTname());
}
// next table
treeNode = treeNode.AOTnextSibling();
}
}


You can search other property by modify below line of code
 "treeNode.AOTgetProperty(strPropertyName)== strPropertyValue"

-Harry

April 22, 2013

Configuration and Security Keys in Axapta

Configuration and Security Keys in Axapta

Security Keys
Microsoft Dynamics AX consists of a number of modules. For example, General Ledger, Project, and Administration. To make it easier for an administrator to set up security keys, they are organized the same way for all modules. Only nine security keys are allowed for each module in the Navigation Pane.
Security keys allow administrators to set security on a user group level. Minimizing access on a user group level helps to reduce the attack surface against potential attacks.
Applying Security Keys

The main reasons to apply user-level security are to:
  • Allow users to do only their designated tasks.
  • Protect sensitive data in the database.
  • Prevent users from inadvertently breaking an application by changing code or objects on which the application depends.
You need to apply a security key to:
  • Tables
  • Views
  • Menus
  • Menu items
  • Form controls
  • Report controls
To create security keys in Microsoft Dynamics AX:
  1. Expand the Data Dictionary node in the Application Object Tree (AOT).
  2. Right-click the Security Keys node, and then select New Security Key.
  3. Right-click the security key object, and then click Properties.
  4. Rename the security key by modifying the Name property.
  5. Right-click the object, and then click Create from the shortcut menu.
  6. Right-click the object, and then click Save from the shortcut menu.
  7. Right-click the object again, and then click Check In. This opens the Check in form.
Security Key Properties:

Property Rules
ID Always ship a security key with the same ID as it has been shipped with before.
If you try to create a new security key with an ID that has already been used for a security key in Microsoft Dynamics AX, an error will occur.
Name One of the nine security keys on a branch (the parent) should take the name of the module. For example, BOM. The other keys (up to eight more on a branch) should have the name of the module followed by one of the following suffixes: Daily, Journals, Inquiries, Reports, Periodic, Setup, Misc, or Tables. For example, BOMReports, BOMSetup, and LedgerPeriodic.
Enterprise Portal keys should have a prefix of EP followed by the name of the role. For example, EPAdmin and EPConsultant. Additional security keys for the role should take one of these suffixes: Misc, Info, Report, or Task. For example, EPAdminInfo and EPConsultantTask.
Application Integration Framework (AIF) keys should be the same as the name used for the service. The format is the module that the service is contained in, the document name, followed by Service. For example, in the Sales module, SalesSalesOrderService.
If you attempt to create a security key with a name that has already been used for a security key in Microsoft Dynamics AX, an error will occur.


Label Mandatory property.
AnalysisVisibility Mandatory property for top-level security keys (keys that have no parent key). 
Set to High for any key that corresponds to a core module in Microsoft Dynamics AX, for example, Ledger.
Set to Low for keys associated with tables that will not usually be used for reporting.
Set to None for keys associated with system functionality that should not be shown for end-user reporting.



Configuration Keys


Configuration keys should be defined so that the installation can be set up with only the features needed for each particular installation. By disabling configuration keys, administrators can reduce the potential surface of attack, thereby helping to increase the security of their Microsoft Dynamics AX installation.
Configuration keys allow administrators to enable or disable features in the application for all users. Disabling features helps to minimize the attack surface against potential attacks.
Applying Configuration Keys

Configuration keys are applied to:
  • Tables
  • Fields
  • Indexes
  • Views
  • Menus
  • Menu items
  • Form controls,
  • Report controls
  • Extended data types
  • Enumerations
Configuration keys are applied by setting the ConfigurationKey property on these objects in the Application Object Tree (AOT).
Creating Configuration Keys

To create a configuration key
  1. Expand the Data Dictionary node in the AOT.
  2. Right-click the Configuration Keys node, and then select New Configuration Key.
  3. Right-click the configuration key object, and then click Properties.
  4. Rename the configuration key by modifying the Name property.
  5. Right-click the object, and then click Create on the shortcut menu.
  6. Right-click the object, and then click Save on the shortcut menu.
  7. Right-click the object again, and then click Check In. This opens the Check in form.
configuration key Properties:

Property Rules
ID Always ship a configuration key with the same ID as it has been shipped with before.
If you attempt to create a new configuration key with an ID that has already been used for a configuration key in Microsoft Dynamics AX, an error will occur.
Name Follow the standard Naming Conventions.
If you attempt to create a configuration key with a name that has already been used for a configuration key in Microsoft Dynamics AX, an error will occur.
for complete Post plz follow below link

Configuration and Security Keys Best Practice Checks

-Harry

April 06, 2013

UTC DateTime Null Value in Ax

UTC DateTime Null Value in Ax

Some times we need to pass or check null value in UTCDateTime field.
so here is the logic to pass null value in UTCDateTime,

just try utcdatetimenull() function in your code, it will return the same value as 

DateTimeUtil::minValue() function.

In X++ The utcdatetimenull() value is '1900-01-01T00:00:00'.

-Harry

April 04, 2013

Finding unused lables

Finding unused labels in Axapta

Here is a small job for finding labels, from a particular label file, that are not used in your whole application code. You need an updated cross reference to use the job. I assumed that you are familiar with label files.


static void findUnXedLabels(SysOperationProgress _progress = null)
{
    Label     label       = new Label('da');// The languageto use for finding the labels
    str 250   labelId     = label.searchFirst('');
    Map       mapLabels   = new Map(types::String, types::String);
    MapEnumerator   mapEnumerator;
    ;

    setPrefix("Finding UnX'ed labels");

    while (labelId)
    {
        if (label.moduleId(labelId) == "XYZ") // The particular label file
        {
            if ((select xRefNames
                     index hint Name
                     where  xRefNames.Kind == xRefKind::Label &&
                            xRefNames.Name == labelId &&
                            xRefNames.TypeName == '').RecId == 0)
            {
                mapLabels.insert(labelId, label.extractString(labelId));
            }
        }
        labelId = label.searchNext();
    }

    // The maps is used to sort the lables
    mapEnumerator = mapLabels.getEnumerator();

    while (mapEnumerator.moveNext())
    {
        info (strFmt("%1 %2", mapEnumerator.currentKey(), mapEnumerator.currentValue()));
    }
}

In standard AX you can run this check for all labelfiles and save the result to a file, by using the \Classes\SysApplCheck\findUnXedLabels method.
-Harry

March 03, 2013

How to find your object in AOT projects

How to find your object in AOT projects

This is a small but precious tool for AX developing.
Have you ever tried to find in which projects your objects are included? Yes, I have... Not so easy to search and look into each project.
Now, it is just a question of one click: this mighty LC Project Search will make the life easier. And good news, it is free. So, profit and enjoy!
There are three xpo-files with appropriate versions for AX 4.0, 2009, and 2012. (I have tested 2009 one). You can import it, then launch with the menu item, and this is ready to go.

Just type the name of any object you're looking for, optionally, you can choose the type of it, then press Search. Be patient, it takes some time to populate the result table.

Now, all projects contain the object are here.
-Harry

January 07, 2013

Open any object from code editor to in AOT node(Editor script)

Open any object from code editor to in AOT node(Editor script)

I have posted a editor script method earlier that can open and browse table for code editor.using below code developer will have ease of opening any object from AX code editor to AOT node.



TO USE THIS CODE COPY AND PASTE THE METHOD IN EDITOR SCRIPT CLASS

void addIns_OpenInAOT(Editor e)
{
    #AOT
    TreeNode        treeNode;
    FreeText        selectedLine;
    str 1           curSymbol;
    int             iCopyFrom;
    int             iCopyTo;
    Set             selectedNodesSet = new Set(Types::Class);
    SetIterator     setIterator;
    Map             map;
 
    void add2Set(TreeNodePath _path)
    {
        ;
        treeNode = TreeNode::findNode(_path + #AOTRootPath + selectedLine);
        if (treeNode)
            selectedNodesSet.add(treeNode);
    }
    ;
    if (e.markMode() != MarkMode::NoMark && e.selectionStartCol() != e.selectionEndCol())
    {
        selectedLine = strLRTrim(subStr(e.currentLine(), e.selectionStartCol(), e.selectionEndCol() - e.selectionStartCol()));
    }
    else
    {
        selectedLine = e.currentLine();
        for (iCopyFrom = e.columnNo()+1; iCopyFrom >= 0; iCopyFrom--)
        {
            curSymbol = subStr(selectedLine, iCopyFrom, 1);
            if (!strAlpha(curSymbol) && curSymbol != '_')
                break;
        }
        for (iCopyTo = e.columnNo()+1; iCopyTo <= strLen(selectedLine); iCopyTo++)
        {
            curSymbol = subStr(selectedLine, iCopyTo, 1);
            if (!strAlpha(curSymbol) && curSymbol != '_')
                break;
        }
        selectedLine = (iCopyFrom < iCopyTo) ? subStr(selectedLine, iCopyFrom + 1, iCopyTo - iCopyFrom - 1) : '';
    }
 
    if (selectedLine)
    {
        add2Set(#ExtendedDataTypesPath);
        add2Set(#BaseEnumsPath);
        add2Set(#TablesPath);
        add2Set(#ClassesPath);
        add2Set(#MacrosPath);
 
        if (selectedNodesSet.elements() == 0)
        {
            add2Set(#SystemFunctionsPath);
            add2Set(#SystemTablesPath);
            add2Set(#SystemTypesPath);
            add2Set(#SystemEnumsPath);
            add2Set(#SystemClassesPath);
            add2Set(#ClassesPath + #AOTRootPath + classStr(Global));
        }
 
        if (selectedNodesSet.elements() > 0)
        {
            setIterator = new SetIterator(selectedNodesSet);
            setIterator.begin();
            if (selectedNodesSet.elements() == 1)
            {
                treeNode = setIterator.value();
            }
            else
            {
                map = new Map(Types::String, Types::String);
                while (setIterator.more())
                {
                    treeNode = setIterator.value();
                    map.insert(treeNode.treeNodePath(), treeNode.AOTparent().treeNodeName());
                    setIterator.next();
                }
                treeNode = TreeNode::findNode(pickList(map, "Location", "Select element type"));
            }
            if (treeNode && treeNode.treeNodePath() != TreeNode::rootNode().treeNodePath())
            {
                if (SysTreeNode::hasSource(treeNode))
                {
                    if (treeNode.AOTparent().treeNodePath() == #macrosPath && subStr(e.currentLine(), e.selectionStartCol() - 1, 1) != '#')
                        return;
                    treeNode.AOTedit();
                }
                else
                {
                    treeNode.AOTnewWindow();
                }
            }
        }
 


Click here the origional post....

-Harry

November 24, 2012

The MorphX Tools - Project Designer

How to Create a Project in AXapta

For a fully customizable overview of the elements, you can use projects. In a project, elements can be grouped and structured according to the developer’s preference. The Project Designer is a powerful alternative to the AOT because you can collect all the elements needed for a feature in one project.
Creating a New Project
You open the Project Designer by clicking the Project button on the toolbar. Figure 1 shows the Project Designer and its Private and Shared projects.

Figure 1. Project Designer, showing available private and shared projects


Except for its structure, the Project Designer behaves exactly like the AOT. Every element in a project is also present in the AOT.
When you create a new project, you must decide whether it should be private or shared among all developers. You can’t set access requirements on shared projects. You can make a shared project private (and a private project shared) by dragging it from the shared category into the private category.

Note
Central features of Dynamics AX 2009 are captured in shared projects to provide an overview of all the elements in a feature. No private projects are included with the application.
You can specify a startup project in the Options dialog box. If specified, the chosen project automatically opens when Dynamics AX is started.

Automatically Generated Projects
Projects can be automatically generated in several ways—from using group masks to customizing special project types—to make working with them easier. We discuss the various ways to automatically generate projects in the sections that follow.

Group Masks
Groups are folders in a project. When you create a group, you can have its contents be automatically generated by setting the ProjectGroupType property (All is an option) and a regular expression as theGroupMask property. The contents of the group are created automatically and kept up to date as elements are created, deleted, and renamed. Using group masks ensures that your project is always current, even when elements are created directly in the AOT.
Figure 2 shows the ProjectGroupType property set to Tables and the GroupMask property set to <xRef on a project group. All table names starting with xRef (the prefix for the Cross-reference tool) will be included in the project group.

Figure 2. Property sheet specifying settings for ProjectGroupType and GroupMask

Figure 3 shows the resulting project when the settings from Figure 2 are used.

Figure 3. Project created by using group masks


Filters
You can also generate a project based on a filter. Because all elements in the AOT persist in a database format, you can use a query to filter elements and have the results presented in a project. You create a project filter by clicking the Filter button on the project’s toolbar. Depending on the complexity of the query, a project can be generated instantly or might take several minutes.
Filters allow you to create projects containing the following kinds of elements:
  • Elements created or modified within the last month
  • Elements created or modified by a named user
  • Elements from a particular layer

Development Tools
Several development tools, such as the Wizard wizard, produce projects containing elements the wizard creates. The result of running the Wizard wizard is a new project that includes a form, a class, and a menu item—all the elements comprising the newly created wizard.
You can also use several other wizards, such as the Report Wizard and the Class Wizard, to create projects. You can access these wizards from the Microsoft Dynamics AX drop-down menu by clicking Tools\Development Tools\Wizards.

Layer Comparison
You can compare all the elements in one layer with the elements in another layer, called the reference layer. If an element exists in both layers, and the definitions of the element are different or the element doesn’t exist in the reference layer, the element will be added to the resulting project. You can compare layers by clicking Tools\Development Tools\Code Upgrade from the Microsoft Dynamics AX drop-down menu.

Upgrade Projects
When you upgrade from one version of Dynamics AX to another or install a new service pack, you need to deal with any new elements that are introduced and existing elements that have been modified. These changes might conflict with customizations you’ve implemented in a higher layer.
The Create Upgrade Project feature makes a three-way comparison to establish whether an element has any upgrade conflicts. It compares the original version with both the customized version and the updated version. If a conflict is detected, the element is added to the project.
The resulting project provides a list of elements to update based on upgrade conflicts between versions. You can use the Compare tool, to see the conflicts in each element. Together, these features provide a cost-effective toolbox to use when upgrading.
You can create upgrade projects by clicking Tools\Development Tools\Code Upgrade\Detect Code Upgrade conflicts from the Microsoft Dynamics AX drop-down menu.

Project Types
When you create a new project, you can specify a project type.  Two specialized project types are also provided in Dynamics AX:
  • Test project Project used to group a set of classes for unit testing
  • Help Book project Project used for the table of contents in the online Help system
You can create a custom specialized project by creating a new class that extends the ProjectNode class. Specialized projects allow you to control the structure, icons, and actions available to the project.

-Harry