Friday, 13 July 2018

Create a batch job

Today I will be discussing about how to create a batch job.  Below are the steps which are required to create a batch job.

1. Go to system administration module -> Inquiries -> Batch jobs -> batch jobs











2. It will open a screen of batch jobs. Click on File and select new. A record for batch job will be added. Now add job description and select view tasks.
3. Now add new task by clicking on file then on new button. It will create a new task and you have to set its class name and company account.















4. For class click on text box and it will open list of class.
Note : Your class should extend RunBaseBatch. Then it will be visible in below screen shot.
















5. Now set batch group and run location. I have selected server as run location and batch group empty.




6. Now close task screen and you will be back on batch job main screen. Here you can set recurrence of batch job. For this you will select recurrence and add parameters according your requirements.






















7. Now you will be observing that you job is in withhold status. In order to start its execution. Change its status to waiting by clicking on functions drop down. Select change status then waiting option.


















Keep checking your job by refreshing it. Its status will be change from waiting to executing and then to ended.  There are chances you job might encounter errors. You can check them by clicking on log button available in action pane.

Create batch job using x++

Today I will be discussing about how to create batch job through x++.  Before going in code lets discuss what are batch jobs.

Batch job : It is group of tasks that submitted to an AOS for automatic processing. These tasks can run sequentially or simultaneously. Additionally, we can create dependencies between one task and another which means that we can setup a different sequence of tasks, depending on whether an earlier task successfully processed or fails.

You can create batch jobs either manually or by code. But here I will be showing a code snippet for batch job creation through x++. I have created a job just for demonstration which will create batch jobs. .













Note:  TestDemo class is my custom class that extends runBaseBatch. It will have its own run method which will contain business logic.
.
public class TestDemo extends RunBaseBatch
{}

Batch job Id :  It will be recid of current batch job.
SysRecurrence : This sysRecurrence class will be used to set recurrence of job. You may set it to default recurrence or as per your requirements
SysRecurrenceUnit : This method will be used to set count for retry. It need parameters and i have choosen 1 minute for retry.
Batchinfo : It will give batch information.
AddTask   : It will create /add task in batch job.Two parameters are required in this method one is  yourclassname and another is batchjobid.
parmCaption : It will be used for setting caption of job.

Tip : You can use this code for creating a single batch job with single task and as well as multiple task. It depend upon your requirements whether you want multiple task in parallel for instance dependency task.

For dependency task use this method : batcheader.addDependency(batchtask2, batchtask1, batchDependencyStatus::FinishedOrError);




Import and export label file in AX2012

Today I will be discussing about how to import and export label file in AX 2012.

Export label file 

Below are the steps required to export label file.
1. Open Dynamics AX. Go to AOT (Ctrl+D). Now expand label files node - select your label file - select language.
Note : I am exporting en_us language here.




















2. Right click on it. Select export file option. It will require path on which you want to place file.


















Import label file
Below are the steps required to import  label file.
1. Open Dynamics AX. Go to AOT (Ctrl+D). Now go on label file node and right click. Select create   from file option.













2. Select file from given path and it should be in ald extension. After selecting file a prompt will appear to replace or override file if it already exists.
Note: File will in ALD as show in below screen shot.

Tuesday, 10 July 2018

Cannot override method on list page form

Today, I will be discussing about the reason for which we cannot override method on list page form.
Lets take the example of RetailStatementListPage. On this form if any one want to override delete command button click method but it won't be possible. As in below given screen shot the override method option is not available.

 






















Reason : In AX 2012 list pages can be directly deployed to Enterprise portal (EP). So, overriding controls of method is not allowed because they may be used in Enterprise portal.

If you really want to override the method then you need to change displayTarget property of the button to client and after this action you will be able to override it.
Please note that in this case you won't be able to use that method on EP. So, first be sure about your requirements.

Expired certification issue on development machines

Today, i will be discussing about one of the common issue of expired certification on development machine. You guys must have observed one of the common error while accessing AX through web browser typically using this URL (https://usnconeboxax1aos.cloud.onebox.dynamics.com/).
Error :  'There is a problem with server ' Sorry the server encountered a error. It is either not available or it cannot respond at this time. Please contact your system administrator. 






There might be different reasons for this error for instance: IIS services is not running or AX certification has been expired.
For better verification we will check first event log. It will  give us more details of this error. 
See in below screen shot the event log is giving ExpiredCertificateException.













Further on we can check our certificates by going on this navigation : Search Certificates -> Local Computers ->Personal -> Certificate 
Here you will find 4 expired certificates by checking there dates in expire column. 








Solution :  Replicate the certificates and update all references of expired one with new.
Following are the steps to go through this process.

1. Find certificates by going on following navigation : Search in Windows Start Menu : Certificates -> Local Computers ->Personal -> Certificate. They all will be expired.
  • DeploymentsOnebox.DaxRunnerTokenUserCertificate.pfx
  • DeploymentsOnebox.LcsClientCertificate.pfx
  • DeploymentsOnebox.MRClientCertificate.pfx
  • DeploymentsOnebox.SessionAuthenticationCertificate.pfx
2. Identify thumbprint of each certificate. By double clicking on them. It will open a screen, from there select Details tab. Search thumbprint there and you will get key from there. 
Note : Here I have opened DeploymentsOnebox.SessionAuthenticationCertificate.pfx. I will show the steps for one certificate rest of all certificates can be replicated  by following same steps.
3. Copy the key from there. In my case key is ‎f7 9c 64 b7 cd 90 91 13 28 81 8a 2b 10 df 8b da 27 36 cc 8e.
























4. Clone the certificate by opening the power shell as administrator and execute below mentioned  command. In my case i have used my own key shown in above screen shot where as 999 is duration of months after which certificate will be expired. You may set your own key and duration as per your requirements.

Command : 
Set-Location -Path "cert:\LocalMachine\My"
$OldCert = (Get-ChildItem -Path F79C64B7CD90911328818A2B10DF8BDA2736CC8E)
New-SelfSignedCertificate -CloneCert $OldCert -NotAfter (Get-Date).AddMonths(999)

Execute the command and you will see new certificate will be created. Copy the new key from power shell since you have to replace it on different places with old one in order to update reference.

5. Now update the newly created key in all referred files. For this process we need to update three files located in C:/AOSService/webroot/
  • wif.services.config
  • web.config
  • wif.config






Note : Open all these files in Notepad++ as administrator and replace old key with new one by using find and replace options. In last save the file.

6. Repeat same for all other three certificates.
7. Reboot the machine because it will restart all services. After reboot you will be able to access AX on web browser.

Friday, 6 July 2018

Number of dimension values specified is different from the number setup in the active format for data entities

Lets discuss about the one of the issue (Number of dimension values specified in application development is different  from the number setup in the active format for data entities ) which anyone might face while import or export operations using entities.
Lets assume there is one of the common scenario in which you are uploading records for customer groups  along with its  financial dimensions using data entities.












Problem : Number of dimension values specified in application development is different  from the number setup in the active format for data entities.

Root cause :  There is difference in number setup of  excel file and active format of data entities.

Solution : Check your active format for financial dimension on following navigation (General ledger - Charts of accounts - Dimensions - Financial dimension configuration for integrating applications) and update excel file according to format or change its format. Then try to import data by using entity.

Below is the file format for customer groups uploading process through entities. For dimension value we are using  format Dimension1-Dimension2-Dimension3.


Import and export project in D365

Today, lets discuss about the process of importing and exporting projects in D365.

Export Project

Following steps are required for exporting project in D365.

1. Open visual studio as administrator.
2. Open the project to whom you want to export.
3. Right click on project and select export project option. It will open a screen where you have to give name to your project and axpp file will be generated.














Import Project

Following steps are required for importing project in D365.

1.  Open visual studio as administrator.
2. Go to Dynamics 365 -> Import Project . Or you may open the import screen by pressing Ctrl+R and Ctrl + P keys.




















3. Now select the file from your required path.
Note : Project file will be in axpp extension.

You will be having three options to open project.

  • Current solution : Open project in current solution
  • New solution : Open project in new solution
  • None : It will just overwrite artifacts and solution won't be saved.


















4. After selecting file from path. The hierarchy of artifacts will be shown in this way. You may select limited or all artifacts for overriding.

Custom Business events Part 3 - (Activate custom business event) in D365 F&O

 In this blog we will discuss about the steps to activate a custom business in D365 F&O. As we know that business event catalog does not...