Search This Blog

Wednesday, 26 September 2012

Policy Framework in Dynamics AX 2012

Policy Framework:


The policy framework can be used to enforce rules for the Microsoft Dynamics AX 2012 users to help improve the business process. Below are the three key components of the robust policy framework in AX 2012.
  1. Policy Types.
  2. Rule types.
  3. Policy rules.

Policy Types:


A Polciy type is a collection of all the rule types that are applicable to a given module or feature area.
 
A user in a manager role can be granted permission to define policies of a given type through a menu item that opens a list page.The list page displays all the policies of a particular policy type.
 
Microsoft Dynamics AX 2012 ships with six policy types.These types are specified with the following SysPolicyTypeEnum enumeration values:
 
  1.  Approval Policy.
  2.  Audit Policy.
  3.  Purchasing Policy.
  4.  TrvExpensePolicy.
  5.  TrvRequisitionPolicy.
  6.  VendInvoicesPolicy.

Rule Types:


Each Policy type encompasses an entire feature area;its associated rule types categorize the rule that can be set up for specifix features within that area.For example,airline,hotel,and meals are examples of expense policy rule types.
 
Each Policy type can have any number of related rule types.
 
Unlike policy types,which are static and well known,rule types do  not have to predefined(although they generally  are).For example,the AuditPolicy and VendorInvoicePolicy policy types allow the user to define the rule types that are to be enforced.Rule types for these two policy types do not ship with Microsoft Dynamics AX 2012.All othe types have a predefined set of rule types that do ship with Microsoft Dynamics AX 2012.

Note:Audit Policy Type and Vendor Invoice Policy Type dont have predefine rule type they allow the user to create their own rule type while the other policy types have predefine rule types.

Policy Rules:


Policy rules is basically that kind which holds the data based on that policy will become active or inactive.the best example for this is such a limit can be that the employees can incur a maximum of $1500of airlines for their travel and if their expense exceeds the limit than they have to provide the justification.

Creating a Policy Type:


To create a new policy type,complete the following steps
 
1. Add a new value for the policy type to the SysPolicyTypeEnum base enumeration.
 
2.Create a row for the new policy type in the SysPolicyType table.
 
To create a row for the new policy type in the SysPolicyType table there is simple easy step

Create a new method in SysPolicySetupClass like the below:

private void loadzahid532policy()
{
SysPolicyType policyType = SysPolicySetup::addPolicyType(SysPolicyTypeEnum::zahidpolicy532,HierarchyPurpose::ExpenseControl);
}
 
 
In the above code the HierarchyPurpose shows the purpose of  policy on behalf of that the policy will  open and zahidpolicy123 is the name of the enum that we have created in the step one.

Now call this above newly created method from the loaddata() method of that class i,e SysPolicySetupClass.
 
Now write a simple job to load that policy into the SysPolicyType table as given below.

static void Job1(Ards _args)
{

SysPolicySetup obj=new SysPolicySetup();
obj.loadData();
info("done");

}

Now after running the job the policy will be  inserted into the SysPolicyType table.

Now to open the Policy form you have to create the display type menu item.
 
In that menu item you have to set some properties:
 
Set ObjectType=Form
 
Object=SysPolicyListPage
 
EnumTypeParameter=SysPolicyTypeEnum.
 
Enum Parameter=name of the enum that you have created in the SyspolicyTypeEnum in step 1
 
Paramters=Enum value of the above enum that you have created in step 1.
 
Below are the screen shots of my menu item properties and the enum properties:
 
 
 
 
 
 
 
Now open that newly created menu item and the Polic form will open like the given below:
 
 


Now click on the new policy button as you can see the button in the above image.

when you click the button the new policy creation form will open like this given below:


note:When you open the above form the warning message will appear like the given below:

 
 
To remove this warning when opening the form just click on the parameter button as you can see in the second last image.The new form will open like given below:
 
 





Now select the Companies from Organizational types and than click on the add button and than close the form.
Now the warning will not appear.

Now as you can see in the third last image that there are no rule types are shown.This is because we have not created the rule types.Now we will create the rule types.

Creating a Rule Type:


Now add the below line of code in the method loadzahid532policy() that we have created above in the previous steps.
 
SusPolicySetup::addRuleType(policytype,SysPolicyRuleTypeEnum::TrvAirlinePolicyRule,formStr(TrvPolicyRule));
 
The above code will add the rule i.e TrvAirlinePolicyRule in our new created policy.
 
 Now again run the job again that we have created in the previous steps.
 
 Now rule type is added in our policy as you can see in the below image:
 
 

 
 Microsoft Dynamics ax ships with many rule types.You can create many rule types as you want in a single Policy.
 
Now the next step is creating Policy Rule.
 

Creating Policy Rule:


Now click on  Airline and than click on the CreatePolicyrule button as you can see in the above image.

An exception will generate as you can see in the below image.

This exception has taken my 2 days to fix :( :(



 
 
 
The scene is that when we click the button i,e create policy rule.A new form i.e TrvPolicyRule
is open.
 
Inside the init method of that form there are several switch cases present as you can see inside the init method of  the form TrvPolicyRule.
 
Basically these switch cases are checking from which syspolicytype enum these form is called and than setting the data according  to them.
 
In our case we have created our new type enum and the swich case of our newly created type is not present in the code therefore it was throwing an exception.  
 
Note:Only in case of travel expense and travel requisition we need to insert the cases.
 
As you know i am implementing travel expense policy therefore i will add the switch case for
setting the travel expense below is the screen shot available:
 
 

 
 Now again click on the button create policy rule.as you can see in the image below.


 
 after clicking the form a new form will open as you can see in the below image.































Now the above form is for creating the policy rule for the Airline expense.

I have created the rule that if the user expense is greater than  1000 than he has to enter the justification why his expense increases the limit.

 
Now press the ok button.Your Policy is created successfully.

Note that the policy needs to be active to take effect.

Now you can see in the below image that how this policy works when the user goes into the Employee self-service portal and creates his expense report for the airlines expenses and tries to submit it.

















Now you can see in the above image that the policy framework’s warning icon gets activated which we have setup back in the expense policy for airlines. just because of his expense has exceeds the limit that we have set. He will now have to go to the expense line again and enter a justification for this expense exceeding maximum allowed amount, for him to be able to submit the expense report.

As you can see in the below image.

 
The Microsoft Dynamics AX 2012’s policy framework is flexible enough to define any number of very simple to complex audit policies across your organization under the Expense Management, Vendor invoices, purchase orders etc. areas, there by allowing your admin staff and reviewers focus on their day-to-day work more, rather than spending time in evaluating business processes violations manually.
 
 
Thanks :) :) :)


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 






 


 

Wednesday, 29 August 2012

How to create a free text invoice and than make interest note against the FTI and than settle the payment against the interest and interest fee in Dynamics Ax 2012



Free Text Invoice:

A free text invoice is an invoice that is not attached to a sales order. A free text invoice contains a header and one or more lines for items or services that are not tracked in inventory. Use a free text invoice for sales that do not require a sales order, packing slip, and customer invoice. For example, you can use a free text invoice for a consulting fee or services fee, or for a miscellaneous fee for an event reimbursement.

Step 1:Creating the free text invoice:

Note:I will show you the data using the com company so you should load com data.

Goto Account Receivable->free text invoices->all free text invoices.

Now click the new->free text invoices in the action pane.

Now in the free text invoice header.

Select customer account=RCUS000016.

Billing Classification=UTL.

Now in the invoice lines.

Select Billing Code=WTR_SWR.

Amount=500.

Below is the screen shot you can also refer to it.
 


Now click the post button in the action pane you can also see in the above image.



After clicking the post button a new dialog box will open as shown in the below image.


Now click on the ok button.Your Invoice will be posted successfully and your invoice number will be generated as shown in the below image.
 
 

 
Step 2:
Calculate an Interest note for above created FTI.
Navigate to AR>Common>Customer Invoices>Open customer invoices.
Select the FTI Invoice created in step 1 as shown in the image below.





Click on 'New interest note-> Invoice' action pane menu item.
-On the Interest calculation form select Bliing classification = 'UTL', Invoice = checked, From date= 6/1/2012', To date= 8/22/2012'
As shown in the image below.
 






Now click on the ok button.The interest is calculated as

 

Step 3:Now we will post this calculated interest Navigate to AR>Periodic> Collection >Interest note-Select the Interest note for Customer RCUS000016 in your scenario may be other customer.-Click the Post button
 
 

On the Post interest note form, change the Print status as 'No' on select query.
-Set Posting date = Current date.
-Click Ok.
 

After Clicking the ok post button the calculated intrest note will posted as you can see in the below image.
 
 

Now create the credit payment of amount 50.This means that the customer has paid the amount 50 against the invoice and its interest note and interest fee.

Click Navigation Pane node: Accounts receivable -> Journals -> Payments -> Payment journal.

Create a new record in the Journal form.

And than select name=custp as shown in the image below.
 
 

Now click on the lines button as shown in the image above.

A new journal voucher form will open.

Now select the account number and than enter the credit payment of amount 50.

Now select the Post -> Post menu button as shown in the image below.

 
 

Now the payment will be posted and infolog will appear as shown in the image below.
 



 
 
Settle the Interest note fee and Interest invoices
Click Area Page node: Accounts receivable -> Customers.
Select Customer account =’RCUS000016’
as shown in the image below. Click the Collect -> Settle -> Settle open transactions button. as shown in the image below.
 
 

The Settlement form will open.Now mark the interest and interest fess and the payment.and unmark the payment.
 
 

Note that we unmark the invoice because we only want to settle the interest and interest and dont want to settle the invoice against the payment.

Now click on the update button your payment will be settled against the interest and interest fees.

Click Area Page node: Accounts receivable -> Customers.

Select Customer account =’RCUS000016’

as shown in the image below.

Click the Customer -> Transactions -> Transctions button.

as shown in the image below.
 
 

Now click on the tractions buttone you will see all transactions that we have done and which transaction is settled.
 

 Note that we have settled the interst note and interst fees so that these transactions should be close now you can also check which transaction are close after settlement.

Go to Account Receivable->customers->all customers->

select your customer

than click the collect ->settle->closed transaction editing

as shown in the image below.

 

 

 
 Thanks :)

Sunday, 12 August 2012

Error 1069: The service did not start due to a logon failure

This type of issue can be occur when user changes its system password and due to change of password reproting service could not be start.Due to this issue SSRS reporting can also not be installed in Microsoft Dynamics Ax.

The execution needs to be redefined whenever the password is changed.

There are some easy steps to resolve this issue:
Step1:Goto Start Menu -> All Programs -> Microsoft SQL Server 2008 -> Configuration Tools

Now click on this the below window will open.


Now click connect and than you see the menus in the left hand side just click that Execution Account as shown in the image below.

Give your credentials here and then click apply and than it will take some time than your Reporting Service will Start.

type services.msc in the start menu and than press enter a new service window will open here search for Sql Server Reporting Services.You can see in its status menu that its start or not if its not start than right click and select start..

I hope this post will help your issues :)

Thanks

Muhammad Zahid

Thursday, 9 August 2012

How To Make Partition In Dynamics Ax 2012

Partitions:         

A partition is a unit of isolation in the AX database
The concept is similar to a company for company specific tables except it is applied to almost all tables
The exceptions include tables related to batch processing, enterprise portal, and services.

Motivation:

A new partition can be used to isolate unit tests and their data from a deployment that has data loaded or that has been corrupted by previously running unit tests

The server team will not accept “partition bugs” that are unit test specific. In other words, unit tests are not a supported scenario, but I have not seen any problems that could not be fixed.

Steps For Making Partitions:

Its quit easy to make partiitions in Dynamics Ax 2012.Just follow the following steps below:

Step 1:Just go to the System Administration->Setup->Partitions as senn below in the image.


















Step 2: Now click the partitions new form will open in that form you will see the existing partitions.You can add the new partition by clicking ithe add button and than give the partition key and partition name as shown in the image below.



Step 3:Now close the form and go to the microsoft dynamics ax configuration as shown in the picture below.


Step 4:Now Microsoft Dynamics Ax configuration utility will open.Now go to Manage and than select create configuration 


Now enter the configuration and than click on




Now enter the name of the partition that you want to apply.and than click apply and than press ok.


Now Run your Microsoft Dynamics Ax your partition will work as i shown in the image below.



Now there is another easy option for running your partition without doing this configuration
just open the command promt and than write the following command.

ax32.exe -partition=partitionname -company=companyname

An example is shown in the picture below


Now if you are planning to run a unit test  on a newly created partition than you need to first initialize the partition without this,many unit tests will fail with a sequence number error in a new partition.
to initialize the partition please run the below job:

NumberSeqApplicationModule::loadAll();
SysUnitTestData_DIR::setupNumberSequences(NumberSeqModule::DIR);
info('done');


Note:

If your unit test use the FIM unit test data(FimUnitTestDataFinancial class) in an existing TTS may still fail in unit test set up.
    The solution is make sure the FIM unit test data in not created in a TTS as shown below.The FIM unit tests data handles its own TTS.





 Thanks

Muhammad Zahid.