Tuesday, October 19, 2010

How to link an Ax user id to an employee

In different areas in Ax, it’s not so much the user id that is needed, but the employee information. In order not to constantly re-identify yourself in the system, you can link both.

How can a user id be linked to an employee?
Make sure you have created both an employee and a user. Now you are ready to associate them with one another. Go to the Administration - User form and select the desired user. Now press the button User relations. Ax will automatically create a new record, if no link already exists.

Go to the second tab page and under Employee, select the wanted Employee.
You have now successfully linked your Dynamics Ax user to an employee.

Linking a Ax user can either be internal (employee) or external (customer, vendor, business relation).
Same method applies for linking with external contacts.
If desired, you can use a wizard to accomplish the above task as well.

Wednesday, October 13, 2010

How to prevent the error 'Division by zero'

Since the early days of programming, the dreaded 'Division by zero' error exists.

And there is no exception in Dynamics Ax.

So if you're gonna write code like A = B /C, you better make sure that C holds a value.
Of course you can do a check with a simple if-statement (if C then A = B/C), but there is an easier way. You can use minOne, a method that exists in the Global class.


myvalueA = myvalueB / minOne(myvalueC);

Definition of minOne:

If myvalueC holds a value (is not zero), it's value is returned. If it is zero, the value 1 is returned.
So better be safe then sorry and spare your users the error message (and execution stop).

PS: I know it has been very quite on this blog the last couple of months.
As you can see, I'm not dead. Nor am I planning on ending my blog, I've just been very busy with other stuff. Thanx for your patience.