Wednesday, November 22, 2017

HOW TO GET DAY OF THE WEEK IN MICROSOFT DYNAMICS AX

HOW TO CONSUME EXTERNAL WEBSERVICES 
IN MICROSOFT DYNAMICS AX 
Firstly add a service reference and then use that service reference in the below code to consume the web services.

// This job uses an external service to run a Bing search 
// The search string is “Dynamics AX” 
static void CallBingService(Args _args) 
{ 
// Replace the string [YOUR_BING_APPID] with your Application ID.
#define.AppId([YOUR_BING_APPID])

// This is the variable for the service client. 
ClrObject clientType; 

// This is the variable for the service client type. 
BingSearch.ServiceReferences.BingV2ServiceReference.BingPortTypeClient _client;

// These are the variables for web query objects. 
BingSearch.ServiceReferences.BingV2ServiceReference.SearchRequest request; 
BingSearch.ServiceReferences.BingV2ServiceReference.SourceType[] sourceTypes; 
BingSearch.ServiceReferences.BingV2ServiceReference.SearchResponse response; 
BingSearch.ServiceReferences.BingV2ServiceReference.WebResponse webResponse; 
BingSearch.ServiceReferences.BingV2ServiceReference.WebResult[] webResults; 
BingSearch.ServiceReferences.BingV2ServiceReference.WebResult webResult;
int integer; 
str string; 
System.Exception ex; 
new InteropPermission(InteropKind::ClrInterop).assert();

// Use a try/catch block to catch errors immediately as CLR exceptions in the job.
   try 
   { 
       //Construct and configure the service client by retrieving the X++ type for the service and using the AifUtil class/

         // Retrieve the X++ type for the Bing service client object. 
       clientType = CLRInterop::getType("BingSearch.ServiceReferences.BingV2ServiceReference.BingPortTypeClient"); 

         // Use the AifUtil class to create an instance of the service client object. 
       _client = AifUtil::CreateServiceClient(clientType); 

       // Create the search request. 
       request = new BingSearch.ServiceReferences.BingV2ServiceReference.SearchRequest(); 
       request.set_AppId(#AppId); 

       // Note the search request string is “Dynamics AX”
       request.set_Query("Dynamics AX"); 
       sourceTypes = new BingSearch.ServiceReferences.BingV2ServiceReference.SourceType[1](); 
       sourceTypes.SetValue(BingSearch.ServiceReferences.BingV2ServiceReference.SourceType::Web, 0); 
       request.set_Sources(sourceTypes);

       // Configure the response for output.
       response = _client.Search(request); 
       webResponse = response.get_Web(); 

       // Get the search results. 
       webResults = webResponse.get_Results(); 
       webResult = webResults.GetValue(0); 

       // Display the first result in the InfoLog. 
       integer = webResponse.get_Total(); 
       info(strFmt("%1 total web results.", integer)); 
       integer = webResults.get_Count(); 
       info(strFmt("%1 results in response.", integer)); 
       info(""); 
       info("First result:"); 
       string = webResult.get_Title(); 
       info(strFmt("Title: %1", string)); 
       string = webResult.get_Description(); 
       info(strFmt("Description: %1", string)); 
       string = webResult.get_Url(); 
       info(strFmt("Url: %1", string)); 
   } 
   // Catch any exceptions.
   catch(Exception::CLRError) 
   {
     // Handle the exception and display message in the InfoLog.
     ex = CLRInterop::getLastException(); 
     info(ex.ToString()); 
   } 
}

HOW TO RUN A REPORT FROM CONTROLLER CLASS IN MICROSOFT DYNAMICS AX : VIKAS MEHTA

HOW TO RUN A REPORT FROM CONTROLLER CLASS
 IN MICROSOFT DYNAMICS AX 

public static void main(Args _args)
{
    // Initializing the object for a controller class, in this case, the class named AssetListingController.
    SrsReportRunController controller = new AssetListingController();

    // Getting the properties of the called object (in this case AssetListing MenuItem)
    controller.parmArgs(_args);
    // Setting the Report name for the controller.
    controller.parmReportName(ssrsReportStr(AssetListing, Report));

    // Initiate the report execution.
    controller.startOperation();
}

HOW TO GET DAY OF THE WEEK IN MICROSOFT DYNAMICS AX

HOW TO GET DAY OF THE WEEK 
IN MICROSOFT DYNAMICS AX 
int sleep(int _duration)
Pauses the execution of the current thread for the specified number of milliseconds
static void sleepExample(Args _arg)
{
    int seconds = 10;
    int i;
    ;
    i = sleep(seconds*1000);  
    print "job slept for " + int2str(i/1000) + " seconds";
    pause;
}

HOW TO GET ENUM VALUE FROM ENUM AS STRING IN MICROSOFT DYNAMICS AX

HOW TO GET ENUM VALUE FROM ENUM AS STRING 
IN MICROSOFT DYNAMICS AX 

static void getEnumValueAsString()
{
    str i;
    i = enumLiteralStr(ABCEnum, "valueInABCEnum");
    print i;
    pause;
}

HOW TO ROUND A DECIMAL NUMBER IN MICROSOFT DYNAMICS AX

HOW TO ROUND A DECIMAL NUMBER IN MICROSOFT DYNAMICS AX 

real decRound(real figure, int decimals)
  • decRound(1234.6574,2); //Returns the value 1234.66.
  • decRound(1234.6574,0); //Returns the value 1235.
  • decRound(1234.6574,-2); //Returns the value 1200.
  • decRound(12345.6789,1) //Returns the value 12345.70.
  • decRound(12345.6789,-1) //Returns the value 12350.00.

HOW TO GET CURRENT DAY OF THE YEAR IN MICROSOFT DYNAMICS AX

HOW TO GET CURRENT DAY OF THE YEAR IN MICROSOFT DYNAMICS AX 
static void dayOfYrExample(Args _arg)
{
    date d = today();
    int i;
    ;
    i = dayOfYr(d);
    print "Today's day of the year is " + int2Str(i);
    pause;
} 

HOW TO CONVERT DATETIME TO STRING IN MICROSOFT DYNAMICS AX

HOW TO CONVERT DATETIME TO STRING IN
 MICROSOFT DYNAMICS AX 
static void jobTestDatetime2str( Args _args )
{
    utcdatetime utc2 = 1959-06-17T15:44:33;
    str s3;
    ;
    s3 = datetime2Str( utc2 );
    info( s3 );
}

HOW TO GET ID OF EDT IN MICROSOFT DYNAMICS AX

HOW TO GET ID OF EDT IN MICROSOFT DYNAMICS AX 
static void EDTNum(Args _args)
{
    int i;
    str s;
    ;
 
    i = extendedTypeNum(AccountName);
    s = extendedTypeStr(AccountName);
    print  int2Str(i);
    print  s;
    pause;
}

HOW TO GET DAY OF THE MONTH IN MICROSOFT DYNAMICS AX

HOW TO GET DAY OF THE MONTH IN MICROSOFT DYNAMICS AX 
static void dayOfMthExample(Args _arg)
{
    date d = today();
    int i;
    ;
    i = dayOfMth(d);
    print "Today's day of the month is " + int2Str(i);
    pause;
}

HOW TO GET DAY OF THE WEEK IN MICROSOFT DYNAMICS AX

HOW TO GET DAY OF THE WEEK IN MICROSOFT DYNAMICS AX 
static void dayOfWkExample(Args _arg)
{
    date d = today();
    int i;
    ;
    i = dayOfWk(d);
    print "Today's day of the week is " + int2Str(i);
    pause;
}

MICROSOFT DYNAMICS AX 2012 AX 2009 KEYBOARD SHORTCUTS :VIKAS MEHTA : DYNAMICS 365

MICROSOFT DYNAMICS AX 2012 AX 2009 KEYBOARD SHORTCUTS :VIKAS MEHTA : DYNAMICS 365

Accelerator Keys
Task Description
Alt+F1
Show Navigation Pane (if it is not in auto-hide mode)

This shortcut works from both MDI & SDI windows, so it is a good shortcut to get back to the main workspace.
Shift+Alt+F1
Enable/Disable auto-hide for the Navigation Pane
Ctrl+Shift+D
Toggles the Content Pane between Developer and Content modes.  Developer mode makes the content frame (where Area pages & List pages are viewed) restorable/minimizable so it is easier to work with developer windows.
Ctrl+F1
Open global search pane
Alt+F5
Toggle the docking status of a docking window
Alt+F6
Move to the next docked window
Alt+Shift+F6
Move to the previous docked window
Ctrl+F6
Move to the next MDI window
Ctrl+Shift+F6
Move to the previous MDI window
Ctrl+Shift+V
Open “Version control parameters” form
Ctrl+W
Open a new workspace
F11
Focus the Address Bar in edit mode (works from anywhere)
Alt+Left Arrow
Shortcut for the Back button on the Address bar
Alt+Right Arrow
Shortcut for the Forward button on the Address bar
From AreaPage, ListPage or developer (MDI) window

Alt+M
Show the Microsoft Dynamics AX Command Bar
Alt+W
Show Windows menu

Hint: do this then press “a” to close all windows.
Alt+V
Show View menu
Alt+H
Show Help menu
Alt
Show Keytips

Press the corresponding key to navigate directly to ActionPaneTab/Group/Button

There may be one or more ActionPaneTabs/Groups/Buttons with the same letter for a Keytip.  To execute a duplicate Keytip, keep pressing the letter until focus is on the one you want and then hit Enter.
  
Standard Forms

Accelerator Keys
Task Description
Ctrl+N
Create a new record
Ctrl+S
Save current record
Alt+F9
Delete record(s)
Ctrl+F4
Close the active window (saving changes)
Esc
or
Ctrl+Q
Close the active window (cancelling changes)
Alt+F4
Close the active window from SDI form (saving changes), Close the application from the main window
Ctrl+P
Print auto-report associated with current form
Ctrl+A
Select all rows in the currently active data source (works regardless of whether you are in a grid or not)
Alt+Down Arrow
Drops down a lookup field or drop-down-list
Ctrl+Alt+F4
or
Menu[i] + G
Go to Main Table Form
F10
Activate the form’s menu bar (File, Edit, etc.)
Enter or Tab
Move to the next field

Enter will skip over buttons and will move to fields across tabs.

Tab will navigate to buttons and will always stay on the same tab page.
Shift+Enter or Shift+Tab
Move to the previous field (same caveats as previous row)
Ctrl+Shift+Home
Go to the first entry field in the form
Ctrl+Shift+End
Go to the last entry field in the form
Ctrl+Page Up
Go to the previous field group
Ctrl+Page Down
Go to the next field group
Shift+F10
Open context menu for current field
Page Up
Move to the previous page of records
Page Down
Move to the next page of records
Ctrl+Home
Move to the first record
Ctrl+End
Move to the last record
F5
Refresh all data sources on the current form
Ctrl+F5
Restore only the active record


Filtering Command

Accelerator Keys
Task Description
Ctrl+F
Find by Field (clears previously applied filters)
Ctrl+K
Filter by Field (appends to previously applied filters)
Alt+F3
Filter by Selection
Ctrl+F3
Open Advanced Filter window
Ctrl+Shift+F3
Clear all filters
Within a Grid

Ctrl+G
Enable/Disable Filter by Grid
Ctrl+Up Arrow
From a grid cell, move focus to the Filter by Grid input cell for that column (Filter by Grid must be enabled)
On a ListPage

Shift+F3
Focus the Quick Filter (“Type to filter” area)
Focus in Quick Filter

Enter
Execute/Clear Quick Filter
Down Arrow
Drop down the Quick Filter’s Field Chooser menu


Actions Specific to Grids SHORTCUTS


Accelerator Keys
Task Description
Ctrl+E
Export to Excel (only contents of grid)
Ctrl+C
Copy:

1)      If Single cell is selected, copies just that cell contents
2)      If the entire row is selected or multiple rows are selected, copies values for ALL fields on all the rows (including those off the grid)
Up/Down Arrow
Move focus to the next/previous record, unselecting the current record
Ctrl+Up/Down Arrow
Move focus to the previous/next record, leaving the current record marked and not marking the newly focused record
Shift+Up/Down Arrow
Move focus to the previous/next record, leaving the current record marked and marking the newly focused record
Ctrl+Shift+Home/End
Mark all records between the currently selected record and the first/last record
Editable Grids

Shift+Space
Mark the current record, leaving previously marked records marked.
Read-only Grids
(such as on a ListPage)

Enter
Execute default action (only on ListPage grids, usually opens the corresponding details form for selected record)

For, Non-ListPage forms, Enter will move to the next field
Left Arrow
Move focus one field to the left.  If focus is already in the left-most column, hitting Left Arrow will “mark” the row.
Right Arrow
Move focus one field to the right.
Ctrl+Space
Mark the current record, leaving previously marked records marked.
Shift+Space
Mark all records between the current record and the top-most marked record (or the top record if none are marked), leaving previously marked records marked.
Shift+Page Up/Page Down
Mark all records between the currently selected record and the previous/next page of records.


AOT SHORTCUTS


Accelerator Keys
Task Description
Ctrl+D
Open the AOT
Ctrl+Shift+P
Open the Projects window
Ctrl+ O  or
Menu + O
Context: Description
Job: Execute the job
Class: Run the main(Args) method
Form: Launch the form
Report: Run the report
Table: Launch Table Browser for this table
Menu + W
Open new AOT window, with only the current node
Ctrl+N
Create a new object
Enter
or
Ctrl+Shift+F2
Edit an object
Ctrl+S
Save current object
Ctrl+Shift+S
Save all modified objects
Delete
Delete current object
F2
Rename current object
Menu + R
Restore the state of the current object from disk, cancelling any pending changes
Ctrl+Shift+I
Import one or more application objects from a file
Menu + X
Export the current node to an XPO
F7
Compile
Ctrl+P
Print the active application object (basically XPO contents)
Alt+Enter
Open the property sheet
Ctrl+F
Find window
Ctrl+G
Compare different versions of the application object
Alt+Left Arrow
Move the object to the level of its current parent node in the tree
Alt+Right Arrow
Make the current object a child of the nearest container above it in the tree
Alt+Up Arrow
Move the object one slot up in its current level of the tree
Alt+Down Arrow
Move the object one slot down its current level of the tree
Number Pad *
Expand all sub-trees under this node
Shift+F9
View breakpoints
Ctrl+Shift+F9
Remove all breakpoints
Source Control

Alt+I
Check the application object into the version control system
Alt+O
Check out the application object for editing
Alt+U
Undo check out

  
Accelerator Keys
Task Description
Ctrl+N
Create a new method/job
Ctrl+S
Save current method/job
F5
Context: Description
Job: Execute the job
Class: Run the main(Args) method
Form: Launch the form
Report: Run the report
Ctrl+F
Find and Replace (Find tab focused)
Ctrl+H
Find and Replace (Replace tab focused)
F3
Repeat the last find
Ctrl+G
Go to the specified line
F4
Go to the next error/warning/task
F9
Insert or remove a breakpoint
Ctrl+F9
Enable or disable a breakpoint
Shift+F9
View breakpoints
Ctrl+Shift+F9
Remove all breakpoints
Ctrl+Space
List properties and methods for the selected object
Ctrl+Alt+Space
Lookup a selected label or text
Ctrl+Shift+Space
Go to the definition of the selected method
F2
List all tables
Ctrl+T
List all Extended Data Types
F11
List all enums
F12
List all classes
Shift+F2
List language-reserved words
Shift+F4
List built-in functions
Alt+R
Open the “Scripts” context menu
F6
Close the current tab discarding all changes since last save
F8
Close, and save the current tab
Ctrl+L
Delete the current line
Ctrl+Shift+L
Delete from cursor to the end of the line
Selection Modes

Alt+A
“Select Area” - Area Selection Mode – clicking and selecting an area in the editor occurs as in typical editors (default setting)
Alt+O
“Select Columns” - Block Selection Mode – clicking and selecting an area will do so in a rectangle starting from the initial mouse cursor position (entire lines are not selected)
Alt+L
“Select Lines” - Line Selection Mode – clicking a line will select the entire row, clicking and selecting an area will always select the entire lines.
Alt+U
“Undo Selection” - Unselect the current selection.

Debugger


Accelerator Keys
Task Description
F5
Go
Shift+F5
Stop
F11
Step into function calls
F10
Step over function calls
Ctrl+F11
Step out of the function
Ctrl+F10
Run to cursor
Ctrl+Shift+F10
Set next statement
Alt+Number Pad *
Show next statement
Shift+F9
View breakpoints
F9
Insert or remove a breakpoint
Ctrl+F9
Enable or disable a breakpoint
Ctrl+Shift+F9
Remove all breakpoints
Ctrl+Alt+Line
Show/hide line numbers
Ctrl+Alt+V
View variables
Ctrl+Alt+C
Display the call stack
Ctrl+Alt+O
View output
Ctrl+Alt+B
View breakpoints
Ctrl+Alt+W
View watch
Ctrl+Alt+M
Toggle workbook mode
Ctrl+Alt+D
Restore default layout
Ctrl+F4
Close window
Ctrl+Shift+F4
Close all windows
Ctrl+F6
Next window
Ctrl+Shift+F6
Previous window
During code execution

Ctrl+Break
Break execution of currently running script.

To open the debugger where the execution is stopped, when the "Are you sure that you want to cancel this operation?", hold SHIFT and click the No button.

Related Posts Plugin for WordPress, Blogger...