July 14, 2018

Solution: Best practice (BP) warning suppression in Dynamics 365 FO

Hi Folks,

In this post, we will discuss how to suppression the best practice warnings while development. It's always recommended to remove/fix all best practice warnings before check-in your code to VSTS. To see all the BP warnings on your project; right click on the project and select Run Best practice Fixer on <Project name>
image

This step will show all the BP warnings for the selected project. Let's see what all the ways we have to fix these.

1. In code itself:
Add suppression line before your method,  with warning type and justification, the syntax is below
[SuppressBPWarning(‘<BPWarningType>’, <Description/Justification>.)] for example [SuppressBPWarning(‘BPParameterNotUsed’, Parameter required by the event interface.)].

This is an example for the same.

clip_image002

2. Edit Best Practice Suppression file (AxIgnoreDiagnosticList)
Every model should have a BP suppression file named AxIgnoreDiagnosticList, for system models, you can find related BP suppression file at
K:\AosService\PackagesLocalDirectory\<ModelName>\<ModelName>\AxIgnoreDiagnosticList

Right-click on your project and select ‘Edit Best practice Suppression’. For all system models, this action will open the related BP suppression file.
clip_image004

For a new model:
In case you created a new model for your development (of course you would Smile )  you have to create this file manually the first time, and on a later stage, you can amend for all BP fixes.
Create a new XML file under below path, I recommend to use a separate Visual studio instance for Create OR Edit this file.

K:\AosService\PackagesLocalDirectory\<yourModel>\<YourModel>\AxIgnoreDiagnosticList

Copy paste below

<?xml version="1.0" encoding="utf-8"?>
<IgnoreDiagnostics>
<Name>myModel_BPSuppressions</Name>
<Items>
<Diagnostic>
<DiagnosticType>BestPractices</DiagnosticType>
<Severity>Warning</Severity>
<Path>dynamics://<warning path></Path> //You can get this path from warning message
<Moniker>BPParameterNotUsed</Moniker> //You can get this from error message
<Justification>FormDataSourceEventArgs e is mandatory parameter for events and not used in the current context.</Justification>
</Diagnostic>
</Items>
</IgnoreDiagnostics>

Keep adding below tag for every warning

<Diagnostic>
<DiagnosticType>BestPractices</DiagnosticType>
<Severity>Warning</Severity>
<Path>dynamics://<warning path></Path> //You can get this path from warning message
<Moniker>BPParameterNotUsed</Moniker> //You can get this from error message
<Justification>FormDataSourceEventArgs e is mandatory parameter for events and not used in the current context.</Justification>
</Diagnostic>
</Items>
</IgnoreDiagnostics>

Some recommendations:
1. Best would be to create a new file using VS and place in the respective folder. Also, while adding new records best would be to edit this file from separate VS instance rather than same solution explorer.
2. You will find the BPWarningType in the warning message. If you not sure about the justification OR if you want to make consistency with system existing BP suppression, see the standard code.
3. I recommend using a separate Visual studio instance for Create OR Edit this file.

Cheers
Harry…

July 08, 2018

Import Data Packages through LCS

Hi Folks,

In my last post, we discussed how to create default data packages through the Asset library. LCS is really a good tool to manage your Dynamics project. Today we will discuss one more tool Configuration and Data manager.

Demo 1:
In the first demo, we will see how to import a single data package.

Step 1. Login in LCS. Select your project.
Step 2. Got to configuration and Data management tool. Below is the landing page
1
here 1. Menu tile, to perform operations
2. Available list of data packages
3. Package details and version
4. List of entities in selected package (its blank here cause of my environment. )

Step 3. Select a package from the grid ( section 2) and click on apply (section 1). The system will ask for destination environment,
2

Step 4: Once you select a destination environment, now you have to select the company (legal entity) where you want to import this data package.
image
Select the company and hit the Apply button.

Step 5: Now you go back to your environment and navigate to Data management workspace. You can see a new project created under Data management to import this data package. You can also track the job from the same screen.

Demo 2:
The above demo applicable for single data package import. You can also select multiple data packages and import them in both Concurrently and sequentially.  Let's see how…

Step 1: Select multiple data projects (all package must belong logically same module/group)
3

Step 2: Click on Apply button and select the first option – ‘Apply concurrently’. On next screen give a tag name.
Step 3: Repeat step 3 to 5 from Demo 1.

If you select the other option ‘Apply sequentially’, the immediate next screen will ask for a sequence of data packages,
image

However, the system will give you default sequence based on name and entity contained. You can update the sequence of each package manually as well.
4

Once you set the sequence, rest steps are the same as the previous import.

I personally found this tool really helpful when a developer really need some test/setup data while development and they can not go back and forth to get dummy data. If the functional team have data in templates/Packages simple you can apply them to any dev/test box.

Try it and share your feedback.

Cheers
Harry…