Friday 31 August 2012

SSRS Security Deployment Issue in AX2012




 

I was getting this error while deploying SSRS reports.

 


 

I found a very useful Solution here:


 

I believe it was Helpful…

 

Thursday 30 August 2012

Automatic Events in Dynamics AX 2012




Introduction:


Automatic Events are those events that are triggered by the environment.

Types:


PreEvent:


The pre-event handlers are called before the execution of the designated method. Each of the pre-event handlers can access the original values of the parameters and modify them as required.

PostEvent:


Post-event handlers are called after the method call has ended. The post-event handlers can modify the return value of the called method.

Implementation:

Below is a sample project that shows how to implement Pre and Post Event Handlers in Dynamics Ax 2012.


This Project contains two Classes PrePostEvents and PrePostSample .  In PrePostSample Class there is a DemoMethod that contains Pre and Post Event handlers.



This Method takes an integer values passed from the Main method and has Pre and Post Event Handlers associated with it. The Properties Window of Pre and Post Event handler looks like this.


                            
                                          

 

The CalledWhen Property in the above Figure has the Value Pre Which Shows that it’s a PreEvent Handler.

 

                                         

 

Similarly, the CalledWhen Property shows that it is a PostEventHandler.

                                        

 
This method simply gets the _args passed by the Main Method.

 

                                       

This method gets the _args passed by the Main Method and replaces its value.

 

                                       


This method passes the value to the PreEvent Handler and the DemoMethod.

Wednesday 29 August 2012

Dynamics AX 2012 Eventing Framework



Introduction:


In Dynamics AX each customer has a set of requirements in the product which are customized by the partners. These Customizations can be broken when a newer version is released by Microsoft. The use of events has the potential to lower the cost of creating and upgrading customizations.

Key Terms:


 Producer:


 The producer is the logic that contains the code that causes a change. It is an entity that emits events.

 Consumer:


The consumer is the application code that represents an interest in being notified when a specific event occurs. It is an entity that receives events.

 

Event:

An event is a representation of a change having happened in the producer.

 

Event Payload:

 
The event payload is the information that the event carries with it.

 

Delegate:

 
 
A delegate is the definition of the information passed from the producer to the consumer when an event takes place.

 
Events provide the following benefits:


Observation:

 Events can be used to generate alerts on any specific behavior.

 Information dissemination:

 Events can deliver the right information to the right consumers at the right time.

Decoupling:
Events produced by one part of the application can be consumed by a completely different part of the application. There is no need for the producer to be aware of the consumers, nor do the consumers need to know details about the producer. One producer's event can be acted upon by any number of consumers. Conversely, consumers can act upon any number of events from many different producers

 

 Coded Events:


  Delegates can be added as members of class.  The syntax for defining a delegate is the same as the syntax used for defining a    method, except that:

1.    The "delegate" keyword is used.

2.    Neither "public" nor any other accessibility specifier is allowed.

3.    The return type must be "void."

4.    The body must be empty; that is, it can contain neither declarations nor statements.

 

Implementation of Coded Events:

 
The picture below shows a simple example of implementing Coded Events in Ax.

 
 


 

 
 
 
 
 


In the above project there are two classes EmployeeSelector and Employee.

Ø  In the Employee class EmployeeSelected is the delegate and EmployeeSelected_SelectedEmployee is the Event handler subscribed to it.

Ø  Adding a delegate is as simple as adding a new method.

 



 
 
 
 
 
 
 
 
 
 
 
 
 
 


Ø  This is how the EmployeeSelected delegate looks like.

 



 

 
 
 
 
 

 
 
Ø  The properties of EmployeeSelected_SelectedEmployee Event handler should be changed like this.
 
 

 



 

 

 

 
 
Ø  Here EmployeeSelector is the class that the EmployeeSelected_SelectEmployee Event Handler points to and SelectEmployee is the method.

      Ø In the AddEmployee Method   this. EmployeeSelected (employee) is a call to
            the EmployeeSelected delegate.

     

 

 

 

 
 
 
 
 
Ø  This is how the SelectEmployee method looks like. The method pointed by the EventHandlerSubscriber should be Static and its return type should be similar to the delegate as shown below.
 


 

 

 

 
 
 
Hope it was helpful to you…

 

 

  

 

Tuesday 28 August 2012

Resolving SqlServer Error 1069


 
I was getting this Error while installing reporting service tools..
 
 
 
 
 
 
In the Reporting services configuration manager the reporting server was not starting and this exception was shown:

 


 
 
 

 

How to Resolve:


1)      In the Reporting Services Configuration Manager go to Service Account tab.

2)      Make sure you enter your Current User Account and Password if your password was changed.   

3)      Now, revalidate your pre- requisites.
 
 
I believe it was helpful..

 

 

 

 

Thursday 23 August 2012

Implementing The Enhanced Number Sequence Framework In Dynamics AX 2012:


Overview


Number sequencing is an essential feature in an Enterprise Resource Planning (ERP) system. Microsoft Dynamics
® AX employs a number sequence framework to generate alphanumeric number sequences. The primary purpose of the number sequence framework is to provide unique, user-friendly identifiers while maintaining a continuous or noncontinuous alphanumeric sequence.


There are two main concepts in Number Sequence Framework.


· Segments:

Is a data entity such as legal entity, operating unit, or fiscal calendar period that can be used to define a number sequence. In the enhanced number sequence framework, a number sequence can have more than one segment.

e.g) J-20-Jan11 is a combination of multiple segments.


· Scope:

Is a valid combination of segments used for a specific transaction or master data entity.

e.g.) Company + Fiscal Calender Period.


Steps


· Create an EDT of type String. In this Example I will use CustGroupId.

· Open the NumberSeqModuleCustomer class in the Application Object Tree (AOT), and add the following code to the bottom of the loadModule() method:

datatype.parmDatatypeId (extendedTypeNum (CustGroupId));
datatype.parmReferenceHelp ("Customer group ID");
datatype.parmWizardIsContinuous (false);
datatype.parmWizardIsManual (NoYes::No);
datatype.parmWizardIsChangeDownAllowed (NoYes::Yes);
datatype.parmWizardIsChangeUpAllowed (NoYes::Yes);
datatype.parmWizardHighest (999);
datatype.parmSortField (20);
datatype.addParameterType (NumberSeqParameterType::DataArea,true, false);
this. Create(datatype);


· Create a new job with the following code and run it:


Static void NumberSeqLoadAll (Args _args)

{

      NumberSeqApplicationModule::loadAll();
}


· In the Organization administration | Common | Number sequences | Number sequences generate number sequence. Delete everything apart from the lines where Area is Accounts receivable and Reference is Customer group.


· Locate the CustParameters table in the AOT and create the following method:



Public server static NumberSequenceReference numRefCustGroupId ()
{
         return NumberSeqReference::findReference ( extendedTypeNum(CustGroupId));
}


· In the AOT, open the CustGroup form and add the following code to its class declaration:

   NumberSeqFormHandler             numberSeqFormHandler;


· Create a new method called numberSeqFormHandler() in the same form:


Public NumberSeqFormHandler numberSeqFormHandler()
 {
     if (!numberSeqFormHandler)
{
      numberSeqFormHandler = NumberSeqFormHandler::new Form(
      CustParameters::numRefCustGroupId().NumberSequenceId,
      element,
      CustGroup_ds,
      fieldNum(CustGroup,CustGroup));
}
      return numberSeqFormHandler;

}



· Override CustGroup data source's create() method with the following code:

Public void create (Boolean _append = false)
{
element. NumberSeqFormHandler ().formMethodDatasourceCreatePre ();
super (_append);
element. NumberSeqFormHandler ( ).formMethodDatasourceCreate ();
}



· Override its delete() method with the following code:

Public void delete ()

{
ttsBegin;
element.numberSeqFormHandler().formMethodDatasourceDelete ();
super ();
ttsCommit;
}

· override its write () method with the following code:

Public void write()
{
ttsBegin;
super();
element.numberSeqFormHandler().formMethodData sourceWrite();
ttsCommit;
}

· Override its validateWrite() method with the following code:

Public boolean validateWrite ()
{
boolean ret;
ret = super();
ret = element.numberSeqFormHandler( ).formMethodDatasourceValidateWrite(ret)&& ret;
return ret;
}


· Override its LinkActive() method with the following code:

Public void linkActive()
{
element.numberSeqFormHandler ( ).formMethodDatasourceLinkActive();
super();
}


· Finally, override the form's close() method with the following code:


Public void close ()
{
if (numberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose ();
}
super();
}


· Open Accounts receivable | Setup | Customers | Customer groups to test and create new entries.