≡ Menu

Today I was facing the report issue that it print three blank pages other than one require page. This issue is due to page body is covering more area then print page size. During development phase we test the print page size by saving the report review as pdf. Followings is the tip which helps me to remove empty white pages from report print.

Check that page size and set it also set the you want print in portrait or landscape.

For example if I have to run the report on A4 and portrait form. Then I will perform following steps to set the print page setting and size of report page.

Right click on gray area of report and click on report properties.



And set the report print and size and also set left and right margins

Page Size




Now note the page size is 8.27. We have to check report body size and it must be less than 8.27 inch. For this right click on White area in report canvas and press f4.

Body Size detail



From property window you can check it body size. If it larger then 8.27 in, then you must reset the table, tablix and matrix to and resize the body to less then 8.27.




Now check rerun the report and save its preview in pdf.




This year MVP summit 2015 was my first visit to US and as well as to Redmond Campus. I enjoyed the Aidan Finn post http://www.aidanfinn.com/?p=13909 before leaving for Seattle.
So please read that article before this especially if you are from MEA MVP region.
The life at Bellevue is different from the area we belong. Here in Pakistan cities awake whole night. Usually traditional street level food dabahs (stalls) open the whole night. But at Bellevue whole cities goes to home at 5 and all restaurant closed at maximum at 9 pm. So when you reach Seattle, you must purchase some biscuits and snacks.

In US, most of electronic devices will be available at Best buy. At Best Buy things are with excellent quality but expensive and there is no cheap version of thing are available. You should coming from India, Pakistan, Sri Lanka, please search and take travelling adapter for your laptop or mobile. Electric switches are different there. If you have to missed that one, then you have to go at Best Buy, usually hotel shuttle drop you at door but they did not wait for you and have to come back on foot which is certainly walk for more than 30 minutes.

You must have pair of comfortable shoes. There are a lot of walk. Most of MVP were in casual The don’t take three piece suit with you, Redmond is min city, much more than town, office, training centers. The area is so beautiful that most of the time you like to walk on foot. And most of the time people wear the Joggers.

Most of the MVP, took car on rental or take Taxi. Not everybody afford it, so wait for bus at Seattle airport, it is cheapest way to reach hotels at Bellevue. And you easily cover this area in 2.5 dollars which is quite economical then 60 to 100 dollar taxi. You can save this amount.

Time management is important, the last bus took you back from Microsoft campus to hotels left at 5:30, and you must reach building 33 before it. So focus on time.

Halal food, is really problem if you are Muslim. In all events at Hotel Hyatt, halal food was easily available. At one corner you certainly found small table with banner with halal written on it. You request there and they will delivered it to you.
If you are muslim, hindi, tamil, Turkish or arab. You can find many Arabic and Indian Pakistani food at building 92 at common mix. I took vegetables and tandoori Churgaha, taste was not good but Biryani there was too spicy.

Then you have good camera. And your personal card as well as company cards, there a lot of people. And every one is itself world in himself, writer, blogger, technology experts. There are a lot of activity there where you can took pictures.
And more interestingly you have a lot taste of Coffee, you did not found tea easily.



X++ code for these Invent transfer and movement journal is available in different blogs and website. The voucher number for these entries is little bit tricky. This Voucher Number is set InventJournalName as fellow screen.


By writing this simple tip I used out of demo vm with contoso data.

So If expand the InventJounralName table we will find this voucher sequence number set in VoucherSequenceNumberTable field.


If we expand the Relation node of InventJournalName table we find its relationship with Sequence Number table based on RecId.


For getting next voucher Number for Journal lines we have to use static method of NumberSeq  as



InventJournalName   inventJournalName;

NumberSeq     _sequence;

num _voucher;

select firstOnly inventJournalName

where inventJournalName.JournalType == InventJournalType::Any


_sequence=   NumberSeq::newGetNumFromId(   inventJournalName.VoucherNumberSequenceTable);




Today I got very small task to remove date validation. This validation appear in out of the box and did not let create functionality for previous dates. Surprisingly I did not find any validation code in form. Later I discover that at table level  validation logic was written in function “validateField(FieldId _fieldIdToCheck)”.


Hi all, today I have very small tip, I have inject some data on one of custom table written by some different team.  But update throw exception

 Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode



Table is custom I update the required filed by following code snippet.

Suppose table name is “Xyz”.





select forUpdate * from xyz where xyz.recid== _RecId ;

try {


_Value= “Abcd”;

xyz.Name = _Value;


xyz.ValidFrom =today();










Reference https://community.dynamics.com/ax/b/axstart/archive/2014/03/02/valid-time-state-tables-and-date-effective-data-in-combination-with-dmf-and-wcf-aif


Let start work on fake requirement. Suppose we are working in HR module and client wants that worker will add their expense and send for Approval.


For this requirement, first we create a custom table and create its relation with Worker table. And then develop a custom workflow on it.

So this post contains tasks

  • Table creation and relation with worker
  • Create a simple entry form and list page.
  • Workflow




So first we create a new table and generate its relation with Worker ID.


If we open HCMworker table we will find that its primary key is “PersonnelNumber”.


We add new enum type which has expected values, medical, Certification, Food expense and others. We use Tst as extension for our example’s artifacts.



Now create a new table set its Name as tstWorkerExpenseTable.

Expand table node and right click on relation node. Create a new and set table as HCMWorker.


Rightlick on it new => foreignKey=>Primarykey.


You will find new and new field added, you can rename it, if you check the properties you will the  which will int64 bit.


Now drag and drop enum created in previous step

Rename it to Expense type.



Now add one more field name It Amount of real type and set its label as Amount

Save It. Also create a field group with overview and drag all fields in that group.

Table final structure will be as follow.

Table Final stage



Form create simple form with Name tstWorkerExpense and set its data source as

Now create a simple form and set its datasource as TstWorkerExpense. And set data source properties  “Edit” and “insert if empty” to no.


Add grid on form and drag and drop fields from data source to grid. Save it.  Form structure will be look like.



Run the form you will find something like. You can improve from. It is enough for our current example

Also insert command buttons on action table for new, Edit and delete.




You can improve but for current example it is enough.


Now create a new enum  for which will used as approval status for table.


Drag and drop in fields of tstWorkerExpense. Save table, compile and synchronize, so this will be reflect at SQL Server level.


Now Its time to write some code that will work for state change in workflow steps.

Right click on Method node on tstWorkerExpense and click on CanSubmitToWorkFlow






Update it as follow.


publicboolean canSubmitToWorkflow(str _workflowType = ”)


boolean ret;


if (this.ExpenseStatus ==tstExpenseStatus::NotSubmit)



ret = boolean::true;




ret =boolean::false;



return ret;



New add a new static method with Name “updateworkFlow” and update it as follow


publicstaticvoid updateWorkFlowState(RefRecId _id, tstExpenseStatus _status)


tstWorkerExpense _Expense;


selectforUpdate _Expense where _Expense.RecId ==_id;

if (_Expense !=null)



_Expense.ExpenseStatus = _status;








Now create a Query and This query will later used when we build Workflow type on it.


Add TstWorkerExpense table in it and set field  dynamic to yes.



Now expand AOT and expand workflow right click on new Workflow Category

Custom Cateogry

Set its name tstWorkFlowCategory and set Module as HumanResource.


Save it. Now add a new me display menu Item With name “tstExpenseTable” and set its form tstWorkerExpenseTable.

Menu Item




Now expand workflow and then expand workflow Type right click and run the wizard.

WorkFlowType Wizard




From next window set following properties all based on artifacts we create in pervious steps.


Ie.  Query, workflow category and menu item.  AS we test this workflow only on Ax client so check on rich client


Click on next.



In result a new Ax Project is created


  • Workflow Type
  • Classes
    • Document class which extends WorkflowDocument.
    • EventHandler class which gives implementation to handle different workflow events.
    • SubmitManager class.
  • Action menu items:
    • SubmitMenuItem pointing to SubmitManager class.
    • CancelMenuItem pointing to WorkflowCancelManager class.



Now expand the form (We created this in one above step) and expand its design, and set following properties  to it will workflow enable

WorkflowEnabled =yes

WorkflowDataSorce =tstWorkFlowExpense

WorkflowType = tstWorkerEpense (We created this in pervious step).



Now expand submit manager class in workflow type project and update logic as follow.

And Create a new method with following logic.


public void submit(Args _args)


tstWorkerExpense        workerExpense;

WorkflowComment         note = “”;

WorkflowSubmitDialog    workflowSubmitDialog;


//Opens the submit to workflow dialog.

workflowSubmitDialog = WorkflowSubmitDialog::construct(




if (workflowSubmitDialog.parmIsClosedOK())


workerExpense = _args.record();

// Get comments from the submit to workflow dialog.

note = workflowSubmitDialog.parmWorkflowComment();





workerExpense.ExpenseStatus  = tstExpenseStatus::Submit;



// Send an Infolog message.

info(“Submitted to workflow.”);


catch (Exception::Error)


error(“Error on workflow activation.”);







public static void main(Args args)


tstWorkerExpenseSubmitManager submitManager = new tstWorkerExpenseSubmitManager();





Now Create a we create workflow approval.

Expand Workflow node in AOT and then again expand Workflow approval.




Now you have to use the following artifacts we created in previous steps.


Document, which we created through workflow type wizard and tables field group. And




Again new project created.

New Approval Project is created


Now expand TsWorkerExpenseAppEventHandler and update following methods.

public void returned(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::ChangeRequest);




public void changeRequested(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::ChangeRequest);



public void denied(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::Reject);




public void completed(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::Approve);



public void canceled(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::Cancel);



public void started(WorkflowElementEventArgs _workflowElementEventArgs)


tstWorkerExpense::updateWorkFlowState(_workflowElementEventArgs.parmWorkflowContext().parmRecId(), tstExpenseStatus::Submit);




Now expand the workflow and in sub node Supported Elements, drag and drop approval artifact.










Now create a new menu item and set its form and set its following properties.


  • Form WorkflowTableListPage
  • EnumTypeParameter to ModuleAxapta
  • EnumParameter to Basic.



Now generate increment CIL. It is necessary step.



Click on this and open the workflow design.



Navigate to the menu item to open WorkflowTableListPage to design the workflow.

Click on new button.



Drag and drop approval on designer screen and. Link the start to shape and from shape to end .









Today I got small requirement where I have to pick and display current log in user Name, Following code snippet helps me

static void curUserInfo(Args _arg)
    str sUserId;
Name  name;
str departmentName

    sUserId = curUserId();
    info( "Current user ID is " + sUserId );
name= HcmWorker::find(DirPersonuser::findUserWorkerReference(sUserId)).name();
 departmentName=    HcmWorker::find(DirPersonuser::findUserWorkerReference(sUserId)).primaryDepartmentName();
info ("Name is " + name);


Usually we have to debug on server, while debugging option is not enabled. Right way to enable it from AX server configuration utility, but some Ax server configuration utility needs is on default setting and any setting on Configuration utility is un-Affordable due AOS service going to restart.

On other way is to enable debugging option through Window registry. It helps me to enable debugging on server without restart of AOS server.

Windows => run write REGEDIT



Dynamic => 6.0 =>configuration => Original (install configuration) => xppdebug


Set xppdebug to zero



reference :http://blogs.msdn.com/b/cesardelatorre/archive/2008/01/05/how-to-enable-debugging-on-server-dynamics-ax.aspx


Today I got an error when I try to edit customize SSRS report project on environment which I first time use.


“One or more project in the solution were not loaded correctly. Please see the Output Window for details”


Visual studio project opens but report did not load, Application Explore shows the message that

AOS is not connected.


For this I open the control panel, Administrative tools and then open Microsoft Dynamics Ax 2012 Configuration



Click on Refresh Configuration.


After a few second, I edit the visual studio project, it perfectly open.


A few days ago I got chance to work on list page which contains the lines which are assign to current user or login user for approval.

In Dynamics Ax 2012, every workflow is based on some table. Here we create Query and enable workflow on it.

When any record is submit for approval. So how the other Dynamics Ax 2012 workflow create entries in out of the box workflow tables.  If we open AOT there a lot of table which is used by Workflow engine.



For current requirement we have to create custom query which is based on document table and out of the box workflow table. But problem is there too much table and how to understand relation ship between tables.


In Dynamics Ax, when no solution available then best solution is reverse engineering. Explore what Microsoft already did, try to understand it and then create your own solution.


After exploring I found that in procurement module there is “Purchase requisition assign to me” list page where the similar task is done by Microsoft itself.


This list page is based on AOT /Static Query “PurchReqTableAssignedToMe”.

Requisiation AssignToMe

On expanding I found relationship between following tables.


-Document table current example it is PurchReqTable

-SysworkFlowTable (as parent or Header table).

-SysWorkFlowTable ( as child or line table).


purch Assign to me


You can explore this query in more detail and replicate this with respect to required table on your workflow based and use this query in list page.

In this form you have to set design properties to enable it for workflow. For example current PurchRequistionAssignToMe list page has following properties.



Hope this helps