Tuesday, 27 February 2018

Resolve and Cancel Cases in CRM/Dynamics 365 CE using C#


I was working on Service Module and had to develop a tool which can Resolve and Cancel cases.

Here is the C# code for the same.

To Resolve the Cases
        Entity IncidentResolution = new Entity("incidentresolution");
        IncidentResolution.Attributes["subject"] = "Subject Closed";
        IncidentResolution.Attributes["incidentid"] = new EntityReference("incident", guidCase);
        // Create the request to close the incident, and set its resolution to the
        // resolution created above
        CloseIncidentRequest closeRequest = new CloseIncidentRequest();
        closeRequest.IncidentResolution = IncidentResolution;
        // Set the requested new status for the closed Incident
        closeRequest.Status = new OptionSetValue(5);
        // Execute the close request
        CloseIncidentResponse closeResponse = (CloseIncidentResponse)iService.Execute(closeRequest);

To Cancel the Cases
       SetStateRequest request = new SetStateRequest();
       request.EntityMoniker = new EntityReference("incident", new Guid(strGuids[intGuid]));
       request.State = new OptionSetValue(2);
       request.Status = new OptionSetValue(6);
       SetStateResponse objResponse = (SetStateResponse)iService.Execute(request);

Hope this helps.

Happy CRM'ing

Friday, 23 February 2018

Create Apps using new App Designer and Site Map Designer in Dynamics 365


Apps is one of the super good features that were introduced as part of Dynamics 365. We can create custom apps using App Designer.

Here are the steps to create Custom Apps in Dynamics 365

1) Navigate to Setting --> Application --> My Apps or Settings -->Customizations --> Apps.
2) Create New App by giving the following information

Name: Enter a unique name for the app. 
Unique Name: The unique name is automatically populated based on the app name that you specify. It is prefixed with a publisher prefix. You can change the part of the unique name that's editable. The unique name can only contain English characters and numbers
Description: Type a short description of what the app is or does. 
Icon: By default, the Use Default App thumbnail check box is checked. To select a different web resource as an icon for the app, clear the check box, and then select an icon from the drop-down list. This icon will be displayed on the preview tile of the app. 

select the client type that the app will be used for. 
Web: This is the classic Dynamics 365 web browser client. 
Unified Interface: This is the new Dynamics 365 web browser client that has a similar interface across PC and mobile devices. 

App URL Suffix: The app URL is automatically populated based on the app name that you specify. You'll see a preview of how the complete URL looks. The app URL must be unique. 

For on-premises: http://<server>/<org name>/Apps/<App URL> 
For online organizations: https://<server>. crm#.dynamics.com/Apps/<App URL> 

Use existing solution to create the App: Select this option to create the app from a list of installed solutions or just click on Done to Create the App.

Once the App is created, you can add the required components to it.

Click on the Site Map and it will open the Site Map Designer for this App. We can have separate
Site Map for this app.

You can design the Site Map by adding the required components to it.

In the same way, we can add Dashoboards, Entity Forms, views and Charts has to be added to the App.

After you are done with your changes, Publish the App by clicking on the Publish button.

Once you publish the app, you can go to My Apps --> Open the App which you want or you can also frame URL like below.

For on-premises: http://<server>/<org name>/Apps/<App URL> 
For online organizations: https://<server>. crm#.dynamics.com/Apps/<App URL>

Or else user can have access the apps by clicking on Down Arrow just beside Dynamics 365 as shown below.
We can also Assign Security Roles for which we have to give the access.

Hope this helps.

Happy CRM'ing

Friday, 16 February 2018

Dynamics 365 – Plug-in registration tool – Unable to connect to organization


Recently, I was trying to connect to the trail version (9.0) using Plugin Registration Tool which was working some days back. 

The reason for it was with Version 9.0, we have download  all Tools, Dlls fron Nuget.

Here is the way to download the Plugin Registration Tool from nuget

1) Open Visual Studio
2) Create a new Project (Console Application)
2) Go to Tools -> NuGet Package Manager -> Manage NuGet packages for Solution.

3) Browse and install “Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool” version.
4) After installation, go to the project physical folder and open Packages folder.
5) You will see Plugin Registration Tool there and use that connect to CRM for registering plugins.

Happy CRM'ing