Dynamics 365 Archives - Page 88 of 88 - - Page 88

Category Archives: Dynamics 365

Microsoft Dynamics CRM 2015 Web API

Posted On July 17, 2015 by Admin Posted in

Microsoft has released the Dynamics CRM Web API with the 2015 Spring Update. The purpose of this blog article is to demonstrate the use of the CRM Web API for performing different data operations. Before we begin using the Web API there are a few pre-requisites. Azure Subscription Dynamics CRM 2015 Update 1 Dynamics CRM user with System Administrator role Next we need to follow the steps given below to start using the Web API: Enable Web API Preview in CRM. Web API Preview can be enable in Dynamics CRM 2015 Update 1 from Settings> Administration > System Settings. Associate Azure Subscription to your Dynamics CRM Tenant. You can follow the steps given here to associate your Azure Subscription to your Dynamics CRM tenant. Register an App on Azure Active Directory. Log In to Azure and go to Active Directory -> <your directory> ->Applications -> Add Click on “Add an application my organization is developing”. Select “Native Client Application” and enter the name of the application. Enter the Redirect URI as http://localhost/<yourappname> and then click on Ok. Once completed you will be redirected to the application page. Click on “Configure Access to Web Apis in other applications” and then click on “Configure it now”. Click on Add Application and select Dynamics CRM Online and then click on Complete. Next, Under Delegated Permissions check “Access CRM Online as organization users” and click on Save. Also copy and save the ClientID and Redirect URI as we will require this is our code. Create a .Net App to start consuming the Web API Create a new Console Application project in Visual Studio. Right Click on the Project and click on Manage NuGet Packages. Enter “adal” in the search box and then install Active Directory Authentication Library. This will install the required .dlls to help us authenticate using Azure Active Directory. Add the below code in the Main() method of your program. string resource = “https://<yourdomain>.crm.dynamics.com/”; string clientID = “<your client id>”; string redirectUrl = “<your redirect uri>”; AuthenticationContext authContext = new AuthenticationContext(“https://login.windows.net/common”, false); AuthenticationResult result = authContext.AcquireToken(resource, clientID, new Uri(redirectUrl)); Run the code by pressing f5. You will be prompted to enter your user credentials. After entering the credentials the server returns an Authentication Token. The AccessToken and the AccessTokenType (“Bearer”) is what we need to include into every Authorization header of http request. Next into every requests we make to the CRM Web API we need to pass this authentication token. Below is a Sample Code which demonstrates use of CRM Web API for Create, Retrieve, Update and Delete Operations. using Microsoft.Crm.Sdk.Samples.HelperCode; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using WebAPITest.Entities; namespace WebAPITest { class Program { static string resource = “https://destroyskynet.crm.dynamics.com/”; static string clientID = “<your client id>”; static string redirectUrl = “http://localhost/webapitest”; static void Main(string[] args) { AuthenticationContext authContext = new AuthenticationContext(“https://login.windows.net/common”, false); Task.WaitAll(Task.Run(async () => await DataOperations(authContext))); } private static async Task DataOperations(AuthenticationContext auth) { using (HttpClient httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(“https://destroyskynet.crm.dynamics.com”); httpClient.Timeout = new TimeSpan(0, 2, 0); //2 minutes httpClient.DefaultRequestHeaders.Add(“OData-MaxVersion”, “4.0”); httpClient.DefaultRequestHeaders.Add(“OData-Version”, “4.0”); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(“application/json”)); Account account = new Account(); account.name = “Cloudfronts TechnologiesNew”; account.telephone1 = “555-555”; string content = String.Empty; content = JsonConvert.SerializeObject(account, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore }); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, auth.AcquireToken(resource, clientID, new Uri(redirectUrl)).AccessToken); //Create Entity HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, “api/data/accounts”); request.Content = new StringContent(content); request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(“application/json”); HttpResponseMessage response =await httpClient.SendAsync(request); if (response.IsSuccessStatusCode) Console.WriteLine(“Account ‘{0}’ created.”, account.name); else throw new Exception(String.Format(“Failed to create account ‘{0}’, reason is ‘{1}’.”, account.name, response.ReasonPhrase)); //Retreive Entity //The uri of the created entity is received in “OData-EntityId”. Use the account URI to update/delete account. string accountUri = response.Headers.GetValues(“OData-EntityId”).FirstOrDefault(); var retrieveResponse = await httpClient.GetAsync(accountUri + “?$select=name,telephone1”); Account retreivedAccount=null; if(retrieveResponse.IsSuccessStatusCode) { //Deserialize response into Account retreivedAccount = JsonConvert.DeserializeObject<Account>(await retrieveResponse.Content.ReadAsStringAsync()); Console.WriteLine(“Retreived Account Name : {0} Telephone : {1}”,retreivedAccount.name,retreivedAccount.telephone1); } else { throw new Exception(String.Format(“Failed to retreive account ‘{0}’, reason is ‘{1}’.”, account.name, response.ReasonPhrase)); } //Update Entity JObject accountToUpdate = new JObject(); accountToUpdate.Add(“name”, retreivedAccount.name + “Edited”); string updateContent = String.Empty; updateContent = accountToUpdate.ToString(); HttpRequestMessage updateRequest = new HttpRequestMessage(HttpMethod.Put, accountUri); updateRequest.Content = new StringContent(updateContent); updateRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(“application/json”); HttpResponseMessage updateResponse = await httpClient.SendAsync(updateRequest); if (response.IsSuccessStatusCode) Console.WriteLine(“Account ‘{0}’ updated.”, accountToUpdate[“name”]); else throw new Exception( String.Format(“Failed to update account ‘{0}’, reason is ‘{1}’.”, accountToUpdate[“name”], response.ReasonPhrase)); //Delete Account HttpResponseMessage deleteResponse = await httpClient.DeleteAsync(accountUri); if (response.IsSuccessStatusCode) Console.WriteLine(“Account deleted.”); else throw new Exception( String.Format(“Failed to delete account”)); } } } } Microsoft has also provided helper code to authenticate using credentials stored in the .config file. In my next article I will demonstrate how to use this helper code and authenticate users directly using the credentials stored in the .config file.

Share Story :

Integrating Parature Knowledge Base with Dynamics CRM

Posted On July 16, 2015 by Posted in

The purpose of this blog is to help integrate Dynamics CRM online with Parature Knowledge Base(KB). By integrating Parature KB with CRM, Users will be able to access the Articles in created in Parature without changing the applications. Pre-Requisite: CRM Online with Spring release update Parature Enterprise license Parature account under same O365 tenant as CRM online Purpose of Integration: Parature provides well developed platform for handling service desk for customers. One of the many features provided by Parature is Knowledge Base(KB). Steps to integrate Dynamics CRM with Parature: Configurations at Parature end: Add your CRM organization to the list of allowed URLs in CROS setting in Parature: Go to Setup -> Department Management -> CORS Settings. Add your CRM organization URL.   Configurations at CRM end: Setup Knowledge Management: Go to Service Management under Settings as below: Select Set Up Knowledge Base Management under “Knowledge Base Management” section. Knowledge Management Settings Window pops up as below: Record Types: The list shows all entities available for N:N relationship. When enabling Parature integration for an entity, a many-to-many relationship is created between the entity and the ‘Knowledge Base Record’ entity. Select the record types for which you want knowledge management to be turned on. By default Case entity has Knowledge management enabled. Parature Instance: Dropdown list will give list of Parature instances that can be connected to. Select the Parature instance to be connected to. Parature URL: This is selected automatically on selecting the Parature Instance. Account ID: This is selected automatically on selecting the Parature Instance. It shows ID of the Account. Parature Department ID: Specify the Department ID for which the Parature instance is setup. We must specify this properly since every Department in Organization can have their own knowledge base. We need to specify the Department ID of the department to whose Knowledge base we need to connect. To find the department ID, log on to Parature using Administrators login credentials, select System Overview from Setup tab. Note: You will be able to see the Setup tab only if you have Administrator permissions. Support Portal URL:  Specify the URL of Support Portal. Support portal URL can be checked from Parature by clicking on ‘My Portal’ option on upper right hand side. Select the URL. Click Next. Verify the Details and click Finish. Using Parature Knowledge Base in Dynamics CRM: After integrating Parature Knowledge Base (KB) with Dynamics CRM online, We can access the Knowledge Articles created in Parature in CRM. For Case entity, by default we get KB Articles Section which auto searches the knowledge base:

Share Story :

Redesigned Import/Export capabilities in CRM 2015 Spring Update

Posted On July 13, 2015 by Posted in

Today I will be explaining about the new design of Import/Export feature in Dynamics CRM. Also I will introduce you with Immersive Excel Experience released in Update 1 of CRM 2015. Challenges in old design Before introducing to new enhancements in Import/Export design of CRM 2015, we will go through challenges users are facing in old design. Below is the list of the same. When users export any view from CRM, the file is downloaded either in xls or xml format. Hence, when users open the file in an Excel, a warning message pops up every time. When users export any view from CRM, the data from all the columns are treated as Text columns, i.e. irrespective of your CRM column type (Decimal, Whole Number, Currency, Date & Time) all data is considered as Text. Leading zeros disappear in exported data i.e. if your data any number starting with 0, those zeros don’t appear in Excel. This could represent incorrect data for e.g. if your Order number is 0021578, then in Excel it will show as 21578 which could mislead to users analyzing the data. Composite columns are downloaded as multiple columns in exported data i.e. Full Name column of Contact entity is exported in 3 columns (first name, middle name & last name). Whenever users click Export button in CRM, an Export wizard pops up with options like whether to export records from current page or all pages of view and whether the exported data should be in re-importable format or not. This is an unnecessary step users have to perform for sample data export as well. Enhancements in Import/Export capabilities Microsoft has released plenty of features in this release by overcoming above challenges. Below are the enhancements: One click export – The wizard is gone. Now users just have to click on Export option and CRM exports all records from all the pages. The data is always exported in re-importable format. Also, the file is downloaded in XLSX format. Warning message is gone – As the downloaded file is in XLSX format, the warning message is gone. Data format is retained in exported data – Now, export features read configuration from CRM views and metadata and the data format is retained in exported Excel. Also the exported data is represented as Excel Table and width of the columns are also retained in downloaded file. As shown in above image, the exported data format is retained in the Excel file. CRM uses display names of exported file for mapping purpose while re-importing the data back into CRM. Hence it is always recommended to keep the column names unchanged. Below table shows how CRM data is represented in Excel: Maximum record limit is 100000 – Microsoft has increased limit on number of records that can be exported in Excel file. It has been increased from 10K to 100K. Also now file size limit to upload data in CRM is increased to 32 MB. Users can export Calculated/Roll up fields in Excel. Note: Users can edit these fields in Excel file locally, but the changes cannot be imported back into the CRM. Introducing Immersive Excel Experience In this release, Microsoft has integrated Excel Online capabilities in CRM. It allows users to work on data without moving away from CRM. Below are the features of Immersive Excel capabilities: Ad hoc analysis – As Excel Online is integrated into CRM, users don’t have to move away from CRM. Users can open any public/personal view in Excel Online and take benefits of Excel Online capabilities to work on CRM data. Bulk Edit is possible – Excel Online integration allows users to modify the data right within the CRM and send the data for bulk update. This process runs asynchronously and users can see the import status in logs under Settings -> Data Management -> Imports. In above image, you can see an option to save data into CRM. Also the data is opened in Excel Online right within the CRM. As now users can open data in Excel Online, and also data can be updated within the same, need of any third party Inline Editable Grids is gone. Limitations in Immersive Excel Capabilities As Microsoft has integrated Excel Online in this release, there are few limitations which need to be considered. I have listed below the same: It is available only for CRM Online versions. Due to technical limitations, ‘Save As’ option does not work in Excel Online. It only works in web browser. It will not work in Outlook for CRM and tablets. To take advantage of this feature, views must be saved in CRM. It will not work in Advanced Find views.Note: If you have any advance find views and you want to use this feature, you can save the view as a personal view and then use this feature. This feature is not available for sub grids. The threshold value to refresh Excel Online file (generated in CRM) is set to 5 minutes. i.e. after every 5 minutes the file will be refreshed automatically and hence it is always recommended to save your changes periodically in CRM before this limit is exceeded.

Share Story :

Role Based forms

Posted On July 7, 2015 by Posted in

In this blog, we will learn how to use Role based forms in Dynamics CRM and the best practices that should be followed when using Role based forms. What are Role Based forms Microsoft Dynamics CRM allows configuration of security roles in Entity forms. It is quite a common requirement for organizations where they want users of two different security roles to see different fields and sections. For ex, a Sales person would want to see only the Sales details on the form and a CEO/ Director wants more details in the form. Also, there is a possibility that there are 2 product lines which have different set of fields for the same entity. Alternative approaches From the above requirements, most users will think that the above can be achieved using form customizations or JavaScript on the form. While this is true, this approach is not a feasible one when the 2 versions of form which we create are a lot different from one another. JavaScript should be used when there are only few fields which we need to show/ hide on the form based on Security Roles. How to enable/ implement Role based forms Using/ enabling security roles in forms is very straight forward, but we have to be careful to set/ remove the roles carefully for each form. I have created two contact forms as below. As you can also see, there is a button on the top of Form section “Enable Security Roles” which we will use to configure form security By default, both forms are accessible to all the security roles. We will now change the security roles for each of the form For “Contact Form”, we will provide access to only CEO – Business Manager, CSR Manager and Marketing Manager. So Users with roles other than these will not be able to access this form. And similarly I will configure the security roles for the “Contact v2” form. We will assign roles Salesperson and Marketing professional for this form. So we have now created 2 forms which users with different security roles will access. But there are few OTHER things which we need to address before we complete this entire process Things to consider When we implement Role based forms, the following questions pop up in our mind, for which I have also mentioned the solutions Q1. What if the User has 2 security roles and thus have access to both the forms? A: The User will see both the forms and there is an option for user to choose one of the forms in the Top left corner. Refer screenshot below: The answer to Q1 will pop up another question: Q2. If the user has access to two forms, which form will be visible by default to the User? A: There are 2 parts: User access the Entity form for the very first time When a User access the entity form for the very first time, the default form which User will see will depend upon the Form Ordering. This can be checked in Entity customizations like below: Navigate to Form Order à Main form set When User changes the Form from the Dropdown Whenever user changes the Form from the Dropdown, CRM stores the user preference. So when the user logs in next time or navigate to the same entity form next time, CRM shows the form that the user has used previously and will ignore Form ordering for the particular user. Q3: What if a User has access to the entity but has no Access to any of the forms for his Security Role? A: CRM is very smart and handles this by using “Fallback” mechanism. When we configure the Security Role for a form, there is a checkbox at the bottom à “Enable Fallback” As you can read from the Description in the screenshot, this form will be shown to the Users with roles that don’t have any forms assigned. CRM makes it mandatory to select at least 1 form for fallback. Q4: What if I don’t want to make any of my forms as Fallback forms? A: This is a valid scenario as we don’t want the users who are not explicitly assigned any role on the form to see the form. As a workaround, we can create one form as a “Default Fallback” form which will not have any form fields (or 1-2 fields) and configure this form to be a fallback form. Additionally, we can add a web resource (HTML) in this form which says something like this: “If you are seeing this form and do not have access to any other form for Contacts, Please contact Administrator.” Also, we should keep the Fallback form last in the Form Order. This is how the fallback form would look like: I hope this article was helpful. Please send comments if you need any clarifications. Happy CRMing!!!

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange