Tuesday, 31 July 2018

Workflows in D365

A workflow represents a business process. It defines how a document flows, or moves, through the system by showing who must complete a task, make a decision, or approve a document. It is also an integrated feature of Microsoft Dynamics. 

Example shows 
a workflow for expense reports. 





















The workflow editor is a program that you click one time to download. The editor communicates with Dynamics by using services. Therefore, Dynamics can carry a rich, graphical workflow design experience. Workflow development wizards have been ported into Microsoft Visual Studio.



















Consistent Processes 
You can define how specific documents, such as purchase requisitions and expense reports, are processed. By using the workflow system, you ensure that documents are processed and approved in a consistent and efficient manner.

Process Visibility
You can track the status, history, and performance metrics of workflow instances. This helps you determine whether changes should be made to the workflow to improve efficiency.

Centralized Work List
Users can view a centralized work list that displays the workflow tasks and approvals that are assigned to them. This work list is available from the Role Center pages in the Microsoft Dynamics 365 client and Enterprise Portal for Microsoft Dynamics 365 for Operations.

Friday, 27 July 2018

Office integration in D365

In D365 Microsoft Excel can change and quickly analyze data. Dynamics includes an Excel Data Connector app that interacts with Excel workbooks and Dynamics OData services that are created for publicly exposed data entities. The Excel Data Connector app enables Excel to become a seamless part of the Dynamics user experience also it has static feature to export of grid data, directly to an excel spreadsheet. This is useful for quick analysis of data.














The Excel Data Connector app is built by using the Apps for Office framework. It runs in a task pane that contains all app-related actions and information. Office applications are web applications that run inside an embedded Internet Explorer browser window.





















There are three primary scenarios for Excel Data Connector:

Workbook Designer 
In Workbook Designer, the user can select an entity and some fields. The entity and its fields are bound to the workbook. Any data changes can be published back, provided that all the key fields have been included.

Custom Generated Export
Developers can use the Export application programming interface (API) to add a custom export to any page. These custom exports make it easier to edit the data in Excel.

Template Export
Developers can use the Export API to add a template export to any page. These template exports are like custom-generated reports, but they use a predefined template. These template exports also make it easier to edit the data in Excel.

For detail understanding you can refer Microsoft Documentation Office integration

Friday, 13 July 2018

Transaction integrity checking in D365

It is important to ensure the integrity of all transactions within the system. When a transaction begins, to ensure data consistency, it must finish completely with predictable results. If the transaction terminates in the middle, the system should roll back to its state before the transaction began. Use the Transaction Tracking System (tts) to help you ensure database integrity. 



The following keywords help in integrity checking:
ttsbegin – Indicates the beginning of the transaction.
ttscommit – Indicates the successful end of a transaction. This ensures the transaction performed as intended upon completion.
ttsabort – Used as an exception to abort and roll back a transaction to the state before the ttsbegin.

Nested ttsbegins and ttscommits are ignored in that a lock is held until the last ttscommit is reached. However the system does keep track of the tts level. Each time a ttsbegin is called, the tts level increases by one. Every ttscommit decreases the level by one. If possible you will want to make the tts blocks as small as required.  When a record is selected for update, it will lock the records or table to prevent another process from also modifying them.  The shorter the transaction block the less possibility for potential deadlocks.

How to fix certificate expiry in D365

In this blog we will discuss how we can fix the validity of the expired certificates or nearly expired certificates. As far as I know there is no way to extend the validity of such certificates. So in this blog I will discuss the workaround which is creating the certificate clones with new expiry dates.



Step 1:
Certificates get accessed by their thumbprint which is a 40-digit hexadecimal value. You can see it by double-clicking the certificate in the certificates viewer and open the Details tab. We need it to be upper case without blanks and search it in configuration files located in C:\AOSService\webroot.

Files:
1- web.config
2- wif.config
3- wif.services.config

























Step 2:
Clone the cerficate by using powershell command make sure you open powershell as administrator.
Run Command:
Set-Location -Path "cert:\LocalMachine\My"
$OldCert = (Get-ChildItem -Path 43082FE50B4D02562C89EA728B2363C598E84886)
New-SelfSignedCertificate -CloneCert $OldCert -NotAfter (Get-Date).AddMonths(999)


Note: 999 is the number of months the certificate will be valid until. Should be fine for quite some time. The execution of this creates some output thumbprint copy and note the thumbprint of the newly created certificate and replace it in the configuration files mention in Step 1.



Step 3:
Repeat above steps for all the expired certifactes. When you done with the step 1 & 2. Reboot some services (IIS, Batch, SSIS, MR, SQL) on the machine.

That is all you need to do to fix the certificate expiry as shown in image.









Reference links:
Fix Certificate Issues on Development Machines
Rotate the expired or nearly expired certificates on your downloadable VHD

Tuesday, 3 July 2018

How to get item cost price as per storage dimension group setup in D365

In this blog we will discuss how you can get the item cost price of its storage dimension group setup as per financial inventory checks. Below method will get average cost price as per storage dimension of the item.














Code snippet 1.1













Code snippet 1.2






Monday, 2 July 2018

How to enable licensing for your ISV solution in D365

In this blog we will discuss how you can enable licensing for both customer-specific license, and self-signed certificates.

Step 1: Create a Dynamics AX Project.



Step 2: Now add the certificate's public key (.cer file) to your project as a resource. 
2.1 Add New Item and Click Labels And Resources, and then click Resource.
2.2 Now Select the certificate's public key as the resource.





Step 3: Now add License code under Configuration Tab.

















Step 4: Assign certificate to license code property "Certificate".











Step 5: Add configuration key under Configuration Tab.



















Step 6: Assign License Code to Configuration key property "License Code".


Note: Now your Configuration for license is complete all you need to do is to 
associate a configuration key to an element. For demo purpose I am using custom form to enable licensing. In this form button is visible because it isn't controlled by a configuration key at first.























Step 7: Assign a configuration key to button control. When we assign configuration key button will not visible.










Step 8: Now In order to show the button we need to enable corresponding configuration key from License configuration page. But first check your maintenance mode. By default maintenance mode is set to OFF and you need to set it to ON.

Note: You can go through below blog which explains how to Enable maintainenace Mode through Run Command in Command Prompt or Execute Sql query. Change maintenance mode for license configuration in D365










Step 9: Your custom configuration key in License configuration setup you need to follow below steps to show your configuration key.
9.1 Collect the tenant name and ID for the customer to issue the license to. (You can find this information at Settings > About) and run command.
Command: C:\AOSService\PackagesLocalDirectory\Bin\axutil genlicense /file:c:\templicense.txt /certificatepath:c:\tempisvcert.pfx /licensecode:ISVLicenseCode /customer:Your customer Id /serialnumber:Your serial number /password:(Your certification password)
9.2 Now Import the license into the target environment.
Command: C:\AOSService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe --setupmode importlicensefile --metadatadir c:\packages --bindir c:\packages --sqlserver . --sqldatabase axdbrain --sqluser AOSUser --sqlpwd ******** --licensefilename c:\templicense.txt


























Step 10: Enable your configuration key. After refresh your relevant form button control is now shown (in my case button control).

Microsoft Reference Link: ISV licensing

That is all folks, If you have any question or queries feel free to comment.

Sunday, 1 July 2018

How to create self-signed certificates for test and development purposes in D365

In this blog we will discuss how we can create self-signed certificates for only test purposes during development. Make sure this procedure are not supported in production environments.

Step 1: First open Visual studio development command prompt to run following command.
















Run Command and Provide Password for Certificate: 
makecert -r -pe -n "CN=IsvCertTestAuthority O=IsvCertTestAuthority" -ss CA -sr LocalMachine -a sha256 -len 2048 -cy authority -sky signature -b 01/01/2020 -sv c:\temp\CA.pvk c:\temp\CA.cer
























Note: If you need to know the meanings and purpose of the command parameters you can go throught this link https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/makecert

Step 2: Create a certificate by using the CA.

Run Command: 
makecert -pe -n "CN=IsvCertTest O=IsvCertTest" -ss ISVStore -sr LocalMachine -a sha256 -len 2048 -cy end -sky signature -eku 1.3.6.1.5.5.7.3.3 -ic c:\temp\ca.cer -iv c:\temp\ca.pvk -b **/**/**** -sv c:\temp\isvcert.pvk c:\temp\isvcert.cer

Note: Replace stars (Special Character) with date in above command.







Step 3: Convert the ISV certificate to PFX format.

Run Command: 
pvk2pfx -pvk c:\temp\isvcert.pvk -spc c:\temp\isvcert.cer -pfx c:\temp\isvcert.pfx -po ********

Note: Replace stars (Special Character) with your password given above. In my case my password is "123".





Step 4: Import the self-signed CA certificate manually on all the AOS instances.

Run Command: 
certutil -addstore root c:\temp\ca.cer








That is all you want to do in order to create self-signed certificates. At this navigation you can see your created certificates as shown in image.











You can also refer this link above example is taken from microsoft documents.
ISV Licensing .


How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...