Latest Microsoft Dynamics 365 Blogs | CloudFronts - Page 2

Track Emails by setting “Tracked To Dynamics 365” Category in Outlook

Introduction: Ever thought of how tracking in Dynamics 365 App for Outlook could be easier? Guess What? Using “Category Based Tracking” you can now easily track Mails, Appointments and Tasks by simply setting a category on them in Outlook. This feature is beneficial as you can select multiple emails, set the category, and the rest is all done for you. We can also provide the same permissions to a delegate and forget about tracking emails, which will be done by them on our behalf. In this article we will go through how to enable Category based Tracking in Outlook and assigning a delegate to do it for us. Pre – Requisites: Outlook D365 Customer Engagement Dynamics 365 App for Outlook Implementation: Step 1: First we must enable tracking using Categories in Dynamics 365. To do this we must import the “Organization Settings Editor” latest managed solution .zip file present at “https://github.com/seanmcne/OrgDbOrgSettings/releases” in our instance. Once done, open the solution and find “TrackCategorizedItems”. As shown below the default value set is “false” and the current value is not set. Click on Add > then an Edit button is shown where we change the value from “false” to “true” as shown, after which everyone in the organization will be able to see the category in their outlook. Step 2: On Opening Outlook after few minutes, in the categories we can see the “Tracked in Dynamics 365”. Step 3: Now if you want to track any particular mail to Dynamics 365, you can set the category of the mail to “Tracked To Dynamics 365”. When the server-side synchronization takes place, an activity record in created in CRM. In a similar way, we can Right Click on Appointments and Tasks in Outlook to track then in CRM. Step 4: To view  tracking progress you can configure the Dynamics 365 App for Outlook which shows the status as Tracking Pending/ Not Tracked/Tracked. Step 5: In addition to this, we can also configure Delegate access so that you provide permission to another person who will performs these tasks on your behalf and track emails. Right click on the Inbox folder in Outlook > Permissions Click on “New” and add the person whom you want to provide the access and click Add. Modify Permission as Required. Note: If you want the delegate to set the “Tracked To Dynamics 365” category you will have to provide “Edit All” permission. Step 6:  Once this is done, the user with whom the mailbox is shared must add the mailbox in their outlook: Right Click on Root Folder > Add Shared Folder > Add email of the user who has shared their mailbox. After which the Shared Mailbox will be visible. To enable the delegate to set categories of the shared folder you must click on “Share” on the top ribbon in you calendar and provide “Delegate Only” Access to the Delegate. The delegate will receive an email to accept and add the calendar, after which he/she will be able to set the categories on the shared folder mails. Note: After the owner of the folder shares the calendar make sure that the permissions that were previously assigned to the delegate are still intact else the categories sections will be disabled for the delegate. Step 7:  To share the details of other folders under the root folder in Outlook, the process is the same, but you will to provide “Full Read Access” permission to the root folder and the desired custom permissions for the required folder. Conclusion: By setting this tracking category to mails on Outlook you can minimize the number of clicks and easily track activities in Dynamics CRM.

Share Story :

Send Custom Emails using SendGrids API

Introduction: In this blog we will demonstrate how to send custom emails using SendGrids API. Scenario: If we want to send custom emails to customers stored in Dynamics 365 with different email body for every customer based on their data stored in CRM, it is not possible to do so by using the normal Email Editor as it has some limitations while displaying dynamic content. One way of doing this is by creating a console app which will use SendGrids API to send out custom emails for every customer. Pre-Requisites: Visual Studio SendGrid Account Implementation: Step 1: For this demonstration we will see how to send out a mail to a single email. First we create a Console App in Visual Studio Step 2: Once the Project is created Right Click on the Project and select Manage Nuget Packages Browse to the latest Nuget packages and install SendGrid package Step 3: Next we have to create an API Key in SendGrid. Just give a name for a key and Click on Create Key which will generate a unique key. Store this key which will be used in the Code Step 4: Below is the Code to send email: using SendGrid; using SendGrid.Helpers.Mail; using System.Threading.Tasks; namespace SendGridConsoleApp { class Program { static void Main(string[] args) { string sendGridAPIKey = “EnterKeyHere”; Execute(sendGridAPIKey).Wait(); } static async Task Execute(string _apiKey) { var client = new SendGridClient(_apiKey); var from = new EmailAddress(“test@gmail.com”, “From UserName”); var subject = “MAIL Send Through SendGrid”; var to = new EmailAddress(“test@gmail.com”, “To UserName”); var plainTextContent = “Example PlainText”; var htmlContent = @”<!DOCTYPE html><html><head><style> table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 8px; } tr:nth-child(even){background-color: #f2f2f2 } th { background-color: #4CAF50; color: white; } </style></head><body><h2>Important Details</h2> <table><tr> <th>Firstname</th> <th>Lastname</th> <th>Email Address</th></tr> <tr><td>Peter</td><td>Griffin</td><td>pgriffin@gmail.com</td></tr> <tr><td>Lois</td><td>Griffin</td><td>Lois@gmail.com</td></tr><tr> <td>Joe</td><td>Swanson</td><td>joe@gmail.com</td> </tr><tr><td>Cleveland</td><td>Brown</td> <td>clev@gmail.com</td></tr></table></body></html>”; var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg); }}} Step 5: Once the Console App is run the email is send below shown is the sample of the Email sent While running this for multiple customers we can create different HTML body content for each customer and pass it to the CreateSingleEmail function.This approach can also be used to send bulk emails to customers.

Share Story :

Error handing in MS Flows

Introduction: In this blog we will be going through the steps of Error Handling in Microsoft Flows. Implementation: Step 1: We have created a basic flow that is triggered when a HTTP POST Request has be made to the generated URL. The body will contain a JSON array with some data The flow will then take the data passed in the POST request body and for each object in the JSON array, it create a record in Dynamics 365 Customer Engagement as shown below. In the above scenario  we pass the correct data, but in case the data that is passed to the URL is not correctly formatted or the data is missing we will encounter an error and the flow will fail. To handle such situations we will define an action that will take place when an error is encountered. Step 2: To Log the error, we will create another action to create a log error log in Dynamics 365 Customer Engagement.  To make sure that this is created only when an error is encountered we click on the Configure Run After option as  shown There are four options shown, here we select only the “has failed” option which states that the log will be created when there is a failure. Once this is done we can see the the flow shows a dotted red line for the last step, this is because the “Log Error in CRM” action will run only in one scenario i.e. when the above action has failed. The benefits of using this approach in our flows is that we can log all the errors at one place and also store the error response of the previous stage by simply selecting the Dynamic Content in the “Log Error in CRM” action.

Share Story :

[SOLVED] “Corrupted report PDF generated using JavaScript” in Dynamics 365 V9.0

Posted On October 9, 2018 by Clinton D'Mello Posted in Tagged in

Introduction We had developed a functionality for Dynamics CRM v8.2 on Quote Entity by adding a custom button and on clicking a button we run a report, capture its contents using JavaScript, convert it to a PDF and attach the PDF to an Email Record. Below shown is the code snippet quoteInvoice = { runReportToPrint: function () { debugger; var params = quoteInvoice.getReportingSession(); var newPth = Xrm.Page.context.getClientUrl() + “/Reserved.ReportViewerWebControl.axd?ReportSession=” + params[0] + “&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=” + params[1] + “&OpType=Export&FileName=public&ContentDisposition=OnlyHtmlInline&Format=PDF”; //Calling the below function converts the report to PDF format. quoteInvoice.convertResponseToPDF(newPth); }, getReportingSession: function () { var selectedIds = Xrm.Page.data.entity.getId(); selectedIds = selectedIds.replace(‘{‘, ”).replace(‘}’, ”); var strParameterXML = “<fetch distinct=’false’ mapping=’logical’ output-format=’xml-platform’ version=’1.0′><entity name= ‘quote’><all-attributes/><filter type=’and’><condition attribute=’quoteid’ value='” + selectedIds + “‘ operator=’eq’ /></filter></entity ></fetch >”; var reportGuid = “DAF05843-CA33-E711-811E-FC15B42827EC”; var reportName = “Quote Invoice.rdl”; var pth = Xrm.Page.context.getClientUrl() + “/CRMReports/rsviewer/QuirksReportViewer.aspx”; var retrieveEntityReq = new XMLHttpRequest(); retrieveEntityReq.open(“POST”, pth, false); retrieveEntityReq.setRequestHeader(“Accept”, “*/*”); retrieveEntityReq.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”); retrieveEntityReq.send(“id=%7B” + reportGuid + “%7D&uniquename=” + Xrm.Page.context.getOrgUniqueName() + “&iscustomreport=true&reportnameonsrs=&reportName=” + reportName + “&isScheduledReport=false&p:quoteid=” + strParameterXML); var x = retrieveEntityReq.responseText.lastIndexOf(“ReportSession=”); var y = retrieveEntityReq.responseText.lastIndexOf(“ControlID=”); var ret = new Array(); ret[0] = retrieveEntityReq.responseText.substr(x + 14, 24); ret[1] = retrieveEntityReq.responseText.substr(x + 10, 32); return ret; } } The runReportToPrint() function is called when the custom button is clicked Issue and Error Details Once the environment was upgraded to V9.0 we were facing issues as the PDF that was generated was corrupted as show below. While debugging the code we got the following message. On further research we found that the URL has been changed and  below shown is the new path that has to be used which works correctly on V9.0. var pth = Xrm.Page.context.getClientUrl() + “/CRMReports/rsviewer/ReportViewer.aspx”; Once this change was done  we did not get any error and the PDF of the report that was generated opened correctly with all of  its contents.

Share Story :

Get Feedback from customers after Case is resolved using MS Flows

Introduction: In this blog we will use MS Flows to send out Surveys to customers once the Status Reason on the case is “Problem Resolved”. Implementation: Step 1: Below shown is the configuration of the flow. The flow is triggered once the Status Reason field in the case is changed. The statuscode is 5 which means “Problem Solved”. If problem is solved then we send a Survey form to the customer. Step 2: We then send an email to the customer as shown below We can also use the dynamic value by entering the “To” email id same as the one present on the Case. survey link details are mentioned in Step 3. Step 3: We have created a simple Survey using TypeForm once this is done a link will be created and the same can be entered in the Send email step. Then we add a step as shown below which will wait for the response . Firstly we sign in using own TypeForm account details and then Select the Survey from the dropdown and fill in the details as shown below. Once the response is received we have added a step to update the User details who was working on the case. We can create a custom field to store the responses received from the TypeForm step. Conclusion: This is useful to as we can improve customer service by easily by using MS Flows. We can also use Microsoft Forms, SurveyMonkey to create surveys and get responses

Share Story :

Get Geolocation details using Xrm.Device for mobile devices

Posted On September 10, 2018 by Clinton D'Mello Posted in Tagged in

Introduction: In this blog we will use the  Xrm.Device Client API reference to get the location details as it provides methods to use native device capabilities of mobile devices. Implementation: Step 1 : First we have written a JavaScript code to get the Geolocation details and for this demonstration purpose we trigger this code to run on update of a field. We have created a custom field as Coordinates to store the details. Syntax: Xrm.Device.getCurrentPosition().then(successCallback, errorCallback) Below shown is the Code: var cordsLat = null; var cordsLong = null; var Scripting = { Location: function () { debugger; Xrm.Device.getCurrentPosition().then( function success(location) { cordsLat = location.coords.latitude; cordsLong = location.coords.longitude; Scripting.UpdateRecord(); }, function (error) { Xrm.Navigation.openAlertDialog({ text: error.message }); } ) }, UpdateRecord: function () { var id = Xrm.Page.data.entity.getId(); id = id.replace(“{“, “”); id = id.replace(“}”,””); var clientUrl = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest(); req.open(“PATCH”, encodeURI(clientUrl + “/api/data/v9.0/accounts(” + id + “)”), true); req.setRequestHeader(“Accept”, “application/json”); req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”); req.setRequestHeader(“OData-MaxVersion”, “4.0”); req.setRequestHeader(“OData-Version”, “4.0”); var body = JSON.stringify({ “cf_cordinates”: “Latitude: ” + cordsLat + ” Longitude: ” + cordsLong, }); req.send(body); } } Step 2: One important thing to note is the Xrm.Device control is only available in for mobile devices. When we run this script on a mobile device we get an error message and it does not go after turning on the GPS location of the device. Step 3: To enable the script to work on the device navigate as shown belowOnce this is done and  the script successfully runs we have to refresh the page and the details are updated on the Coordinates field as shown below

Share Story :

HTTP POST Requests using Microsoft Flows

Introduction: In this blog we will demonstrate the working of HTTP Request -Response in Microsoft Flows. Implementation: Step 1:  In our example we will make a POST call to our Microsoft Flow so that we can further apply some logic in Flows. The POST request contains the following data. JSON: [{ “name”: “TestName”, “Address”: “TestAddress” }] Now we can use online editor tools to create a schema file of the above JSON. (https://jsonschema.net/). Submit the JSON data and the schema will be generated as shown below. Step 2: Now we go to Microsoft Flows,create a new flow and add the first step as “Request” as shown below: Step 3: We then paste the JSON schema that we earlier saved In the “Show advanced”  options we have to add the following details: Once that is done we select a condition. In our example we  will pass a JSON Array hence we will loop through each item. Here we add a apply to each condition as shown And we add a dynamic output from the previous stage Then inside the apply to each loop we can add any action and take the values passed from the POST request. For this example I create a new account in CRM with the name and address provided as shown below Step 4: Now when we save this flow a URL is generated in the First HTTP Request step. We test the flow by calling this URL from Postman. The URL generated is show below Step 5: Now we open Postman and write the request as shown below Also in the Header section we add the following details Step 6: Once we click on Send the two records are created in CRM as shown below Conclusion: We can call this URL from outside Dynamics CRM as well and using this we explore many more functionalities provided by Microsoft Flows to achieve the desired outcome.

Share Story :

Customer Journeys in Dynamics 365 for Marketing

Posted On July 25, 2018 by Clinton D'Mello Posted in Tagged in

Introduction: In this blog we will demonstrate how to create Customer Journeys in Dynamics 365 for Marketing. As you engage potential customers, they start by discovering your product, evaluate whether it meets their needs, look for a good offer, and finally make a purchase. This process is called as Customer journeys. Pre Requisites: Before we start we need to have live segments towards whom we can target our marketing initiatives. Check out how to create segments here. We also need to have our Marketing emails designed and ready to go. Check out how to create marketing emails here. Implementation: In our scenario we have taken an example where CloudFronts wants to organize a web development webinar and as a marketing initiative we send out emails to web developers. Below shown is the view of the Customer Journey. Step 1: First take a segment tile from the right toolbox panel and drag it on the canvas and we enter the name of the segment that we want to target. Here as stated earlier we have selected a target segment consisting of web developers. Note: The segment will appear only if it is in the “Live” state. Step 2: We drag and drop the Marketing Email tile, and then add a Marketing page in the Marketing email.  We have done this as we have added a link to a marketing page in our marketing email. Step 3: The marketing page designed is as shown below. When the users click on the link in the email they will be redirected to this page which contains a Marketing Form. Step 4: Then we add a trigger tile in the customer journey with the condition to check if the user has submitted the marketing form in one hour as shown below. If the user has registered in one hour then he/she will receive a “Thank You” email with the details of the webinar. And if the user has not registered within the given period of time he will receive another email which says visit us as www.cloudfronts.com to know more about us. Once the everything is set, the customer journey will begin at the specified Start time and accordingly end at the specified End time. Once the customer journey is run completely we can get a lott of insights regarding the events that took place. Step 5: We can go to the Marketing emails section and click on the insights option as shown in the pic below: Below shown are the insights generated: Similarly we can also view the insights generated for the Customer journeys. The below image shows the number of contacts on each of the tiles as they progressed throughout the journey. The arrows show that only 2 contacts out of 7 submitted the Marketing form and hence received the Event details while the rest 5 contacts received the “Visit Us” Marketing email. Conclusion: Using this feature we have a control of how we want our users to interact with the emails and hence generate more and more leads and also gain insights on the process as a whole.

Share Story :

Paging in D365 Customer Engagement v9.0

Posted On July 10, 2018 by Clinton D'Mello Posted in Tagged in

Introduction: The Xrm.retrieveMultipleRecords method is used to retrieve a collection of records in Dynamics 365 Customer Engagement . In this blog we will demonstrate how we can use paging and fetch more than 5000+ records. In CRM when we fetch records using code we only get the first 5000 records, in some cases there are more than 5k records that need to be fetched, we can achieve this using paging. In this blog for the demonstration purpose, we will fetch 3 records per page so that we can see how the paging functionality works in D365 v9.0 Implementation: Step 1: The syntax is as shown below: Xrm.WebApi.retrieveMultipleRecords(entityLogicalName, options, maxPageSize).then(successCallback, errorCallback); Here the in options parameter we specify the query. In our example we will be fetching all the accounts in the system. In the maxPageSize parameter we specify the number of records to be returned per page. By default the value is 5000. In this example we set the maxPageSize as 3 which will return 3 records per page. As the total number of records being fetched are more than 3, the nextLink attribute is retuned with the link to fetch the next set of records. The value of the nextLink attribute returned is already encoded. Before we pass the link to fetch the next set of records we have to make sure to only set the query in the options parameter. We also store all the values returned in a separate variable so that it can be used later. Step 2: The code is shown below. The allaccounts variable will store all the accounts fetched at the end as we keep on concatenating the received results. Code: var query = “?$select=name”; var allaccounts = null; var scripting = { retrieveMultipleContacts() { var url = Xrm.Page.context.getClientUrl() + “/api/data/v9.0/accounts”; Xrm.WebApi.retrieveMultipleRecords(“account”, query, 3).then( function success(result) { var resultRetrieved = result; allaccounts = resultRetrieved.entities.concat(allaccounts); if (result.nextLink != undefined) { console.log(“Next page link: ” + result.nextLink); query = result.nextLink; var splitValue = query.split(url); query = splitValue[1]; scripting.retrieveMultipleContacts(); } }, function (error) { console.log(error.message); } ); } } Step 3: To test this out we can simply trigger this code to run on the change of form fields and while debugging we can check the values returned and stored in the allaccounts variable. Conclusion: The new D365 v9.0 Xrm.WebApi.retrieveMultipleRecords method simplifies the whole process of fetching records using paging.

Share Story :

Xrm.Device.pickFile in D365 v9.0

Introduction: In this blog we will be showing an example to attach the uploaded files to notes using the Xrm.Device.pickFile function in unified Interface in D365 v9.0 Implementation: Step 1: In this example we will create a button on the Contacts entity and we write a JavaScript function to trigger on button click. In Ribbon Workbench after creating a button we create a command as shown below and add the command on the button. Step 2: On clicking on the Upload button a dialog box opens and we can select the file we want, this file will then be attached in the notes section of the particular record. The code is shown below. The name of the Note created, name of the attachment can be changed as required by modifying the code. Code: var crmCustomization = { PickFile: function () { Xrm.Device.pickFile().then( function (result) { var dataRecieved = result; var Content = dataRecieved[0].fileContent; var FileSize = dataRecieved[0].fileSize; var FileName = dataRecieved[0].fileName; var MimeType = dataRecieved[0].mimeType; var recordId = Xrm.Page.data.entity._entityId.guid; crmCustomization.UploadToNotes(FileName, MimeType, Content, recordId); }, function (error) { alert(error.message); }); }, UploadToNotes: function (FileName, MimeType, Content, recordId) { var note = Object(); note[“notetext”] = “New Attachment” note[“subject”] = “Uploaded File”; note[“filename”] = FileName; note[“mimetype”] = MimeType; note[“objectid_contact@odata.bind”] = “/contacts(” + recordId + “)”; note[“documentbody”] = Content; $.ajax({ type: “POST”, contentType: “application/json; charset=utf-8”, datatype: “json”, url: Xrm.Page.context.getClientUrl() + “/api/data/v9.0/annotations”, async: true, data: JSON.stringify(note), beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader(“Accept”, “application/json”); XMLHttpRequest.setRequestHeader(“OData-MaxVersion”, “4.0”); XMLHttpRequest.setRequestHeader(“OData-Version”, “4.0”); }, success: function (data, textStatus, XmlHttpRequest) { var result = data; alert(“File attached to Notes successfully”); }, error: function (XmlHttpRequest, textStatus, errorThrown) { Xrm.Utility.alertDialog(“Error: ” + textStatus + ” ” + errorThrown); } }); }, }; We can see after uploading the file  the note is created with the attachment as shown below

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange