Latest Microsoft Dynamics 365 Blogs | CloudFronts

PSA – Create Time Entry Delegations for all resources

Background: One of the frequent requests we continuously get from our clients is for someone else to do Time entries on behalf of other resources. We know that this can be done using Delegations feature in Dynamics 365 PSA. You can read more about delegations here written by another D365 PSA Expert – Priyesh Wagh : Delegating Time Entries in D365 PSA Example: But if we want to do this for all the Resources, then it is tedious and not practical to ask each resource to create delegate. For example, on of our clients requested that HR should be able to enter Time entry on behalf of any resource in the organization. I also saw that many organizations need a feature like this. So I thought of creating a console application which will get all the Bookable resources of type User and create Delegations. Below is the code that you can use to create delegations for all users in the organization. You can use the same code to create a plugin if you want to automatically create delegate on creation of Bookable resource. Sample Code: You can get the entire code from my Github #region Create Delegations for all User Bookable Resources to Particular person foreach (Entity bookableResource in userBookableResources.Entities) { Entity TimeEntryDelegation = new Entity(“msdyn_delegation”); TimeEntryDelegation[“msdyn_delegationfrom”] = new EntityReference(“bookableresource”, bookableResource.Id); TimeEntryDelegation[“msdyn_delegationto”] = new EntityReference(“bookableresource”, DelegateToId); TimeEntryDelegation[“msdyn_startdate”] = new DateTime(2018, 10, 1); TimeEntryDelegation[“msdyn_enddate”] = new DateTime(2022, 12, 31); TimeEntryDelegation[“msdyn_type”] = new OptionSetValue(192350000); //Time Entry TimeEntryDelegation[“msdyn_name”] = string.Format(“Delegation to HR for {0}”, bookableResource.GetAttributeValue<string>(“name”)); try { Guid DelegationId = _client.Create(TimeEntryDelegation); } catch (FaultException<OrganizationServiceFault> ex) { Console.WriteLine(“Resource: ” + bookableResource.GetAttributeValue<string>(“name”) + ” Error: ” + ex.Message); } } #endregion Note: Please note that the “Delegate to” Resource/ User should also have Delegate role in order to be able to do time entry on behalf of others. If not, then you will face below error:

Share Story :

New D365 Admin portal and new way to access Organization Insights

Introduction: Lot of D365 Administrators would have observed that we no longer see the Organization Insights solution on AppSource anymore. This is because you can now see the Organization Insights on the new Administration portal for D365. New D365 Admin Portal! There is new portal for D365 Administration which is in preview. You will see the option to go to new D365 Admin Portal from the Current Admin portal screen. Administrators can also access the portal from the URL: https://admin.powerplatform.microsoft.com The new portal is also called as the Power Platform since it now includes Administration of your Power Apps and CDS as well. You can manage the environments, do the analytics and lot more things. I am expecting this Portal will be upgraded and will have lot more features in future.

Share Story :

Quote revision in D365 PSA

Problem Statement: D365 Sales on CRM in general has ability to revise Quotes to track the Quotes revision. In sales, the process was to Activate the Quote, and then you get option to Revise Quote which will create the Copy of Quote with new revision number in Draft state. In Project Service quotes, we don’t see the option to Activate Quote or Revise Quote. Solution: Steps to Revise Quote in Project Service Quotes. Close the Quote as Lost using the button – “Close as Lost” Then you can see the button – “Revise Quote” This action will revise the quote with new Revision Number.

Share Story :

[Solved] – Backspace not working in HTML Web Resources

Issue: When we use a HTML web resource in Dynamics 365 CRM forms or even as a separate navigation, we sometimes face issue that Backspace on Text boxes do not work. Why this happens: This happens because in Custom HTML web resources, we add reference to “ClientGlobalContext.js.aspx”. We need this library to gain access to the global context information such as the information specific to the client, organization or user for your Customer Engagement instance* When we use this library, we get issues with backspaces on text boxes where Input type is not “text”. So if the HTML Input type is “number”, “search”, “tel” or anything else Resolution: Resolution 1:  This can be solved by changing the Input type as “Text” for all input textboxes. Then backspace will start working. But this may not be applicable in all scenarios, since it will remove some of the functionality that was intended. In that case, you can use Resolution #2 below. Resolution 2: I have been able to resolve this issue by running the following code on DOM ready: if (window.Sys && window.Sys.UI && window.Sys.UI.DomEvent && window.Sys.UI.DomEvent.prototype) { window.Sys.UI.DomEvent.prototype.preventDefault = function() { }; window.Sys.UI.DomEvent.prototype.stopPropagation = function() { }; } This will allow you to still use the functions that ClientGlobalContext provides, while keeping it from interfering with your key and mouse events. Credit: Stefan Boonstra  * ClientGlobalContext.js.aspx (Client API reference) Happy CRMing!

Share Story :

Dynamics 365 Tip: Sending Emails using Unified Interface

Introduction: The unified client which was released D365 V9 had a very refreshing UI and lots of features. One of the best features in Unified Interface was Timeline view, but the timeline view did not have ability to send emails. The Unified client has a new Email UI with rich text controls and advanced editor. This was not released till recently. So the new environments after v9.0.1.xx have the ability to send emails using the Unified Client. Now you can send Emails using Unified Client like below: Modern Email Editor: Below are some of the features of new Email Editor: Designer, HTML and Preview tabs will allow users to view and format the content across different form factors. A bunch of controls and features provided like advanced styling, linking, find and replace, and insert images and tables will be made available on the email activity and will allow users to format the email instead of relying on external tools or solutions. Note: The Email Editor is not available on D365 Phone App and App for Outlook. It will show all other activities but not email.

Share Story :

Dynamics 365 Client Diagnostics

Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance of Dynamics 365 client application on the web browser and other apps like D365 for Outlook It is also important to note that even if there is high bandwidth, the performance may be still slow because of latency issues. Let us define these two terms: Bandwidth is the width or capacity of a specific communications channel. Latency is the time required for a signal to travel from one point on a network to another, and is a fixed cost between two points. An application designed to send a request, wait for a reply, send another request, wait for another reply, and so on, will wait at least five seconds for each packet exchange, regardless of the speed of the server. How to Check Latency in D365 Online Applications: Dynamics 365 includes a basic diagnostic tool that analyzes the client-to-organization connectivity and produces a report. To run the Dynamics 365 Diagnostics tool, follow these steps. On the user’s computer or device, start a web browser, and sign in to a Dynamics 365 organization. Enter the following URL, https://myorg.crm.dynamics.com/tools/diagnostics/diag.aspx, where myorg.crm.dynamics.com is the URL of your Dynamics 365 (online) organization. Click Run You can see the results like below: What to make of this? The report displays a table with test and benchmark information. Of particular importance is the Latency Test row value. This value is an average of twenty individual test runs. Generally, the lower the number, the better the performance of the client. Although users may receive a satisfactory experience by using connections with more latency, for best application performance we recommend that the value be 150 ms (milliseconds) or less Other Notes: One of the reasons of high latency is that sometimes D365 tenant is setup in a region far from the home region. For e.g. Customers in USA using D365 which is setup in Australia. This will result in high latency for the end users. In these scenarios where most of the customers are in USA, you can contact Microsoft Support to help move your tenant to USA or nearby region. Best practices for improving application performance Maximize how quickly your forms load. More information: Optimize form performance Make sure you aren’t using legacy form rendering, which can make forms take significantly longer to load. More information: System Settings dialog box – General tab

Share Story :

Connecting to On-Prem SQL from Azure Web App

Background: When an enterprise transitions to Cloud, it may still need to leave some assets on-premises for technical or security reasons. Typically SQL DBs will be On-premises for most enterprises. But this should not stop the enterprise from having their Web apps, APIs, services and mobile apps on cloud. The major hindrance in this scenario will be the feasibility for connecting the Cloud based services to On-Prem SQL for seamless transition. Azure allows you to create layer on top of this On-prem assets while safely connecting to them back on your premises using Hybrid Connections. Supported assets include MS SQL Server, MySQL or any resource that runs on static TCP Port. Prerequisites: Visual Studio 2013 or later SQL Server 2008/ 2012 with SQL server authentication Azure SDK Microsoft Azure Subscription Steps: Create SQL Server DB and table. Cerate an SQL User to connect which will be used in the .NET application. Also create some sample data in the table. Create a .NET web application which will read data from table create in Step 1. The connection string will look something like below. Host the application on Local IIS and ensure it works and can connect to SQL. Now host the application on Azure as web-app. You can refer the below link for steps to create Azure Web app. https://github.com/Microsoft/HealthClinic.biz/wiki/Create-and-deploy-an-ASP.NET-web-app-in-Azure-App-Service You will notice that the application will throw error because it will not be able to connect to the On-prem SQL. We will now create a Hybrid connection to the SQL DB. Navigate to App Service which we created in Step 4 in Azure, and navigate to Networking. Click on Hybrid Connections > Configure your Hybrid Endpoints Create New Hybrid Connection. Enter the details for Hybrid connection like below: Note: usually the TCP Port no for SQL is 1433. Please check for the SQL you are configuring. Download the Hybrid connection manager and install on the SQL server or any server on the same network. Open the installed Hybrid Connection Manager UI, and enter the connection string of the Hybrid connection we created in Azure. You can get the connection string of the Hybrid connection by clicking on it like below. Enter the Connection String in Hybrid Connection Manager UI. If everything is proper, you should see the status as Connected Like below in the tool as well as in Azure. In Azure: Other Notes: If you are facing issues with connection, you can restart the Hybrid Connection service from Local services. Please comment below in case of queries.

Share Story :

CRM Tip: Automatically Creating document from Word Template and attaching to Record

Background: In Dynamics CRM, one of the common requirement customer have is to Run a report and save the copy of the report (PDF/ Word/ Excel) as notes/ attachment on the record or send the created document as email attachment to customer. Sounds an innocent requirement, right? With CRM online, it is NOT. What we do to achieve this till now We do one of the following when the customer asks this request: Ask user to manually run report, download PDF and create email record or attach to record notes. Use some paid 3rd party tool. Tell the customer it is not possible For CRM Online. 😀 For On-prem CRM, developers would tweak the Report Viewer and somehow manage to achieve this with lot of effort and custom plugins. Alternative: With Dynamics 365, you have one alternative which does not exactly give you the above solution but is very close or may be acceptable adjustment to client. We all know CRM 2016 also introduced word templates. But with D365, CRM has inbuilt Action to Run a word template and attach that to document without user action. Since it is an action, it can be used in Workflows, Plugins, other actions and even in JavaScript using Web API. Example: I have created a workflow on Account Credit limit update, such that when credit limit is more than 10,000 an Account summary will be created using the Account Summary template and attached to the record. See screenshots below of the workflow and generated document. All this without user intervention. Limitations: We cannot create PDF documents using this approach This is limited to Word templates and they are not yet as powerful as SSRS reports Next Steps: We can extend this functionality by may be having plugin on notes creation to send an email to customer or any other thing? Please post your comments/ suggestions below. Happy CRM’ing

Share Story :

CRM – Issue with retrieving large document body using Fetch XML

Problem Statement: When we want to export Attachments from CRM (both Notes and Email attachments), we can do this using a Console Application where we read the documentbody from CRM using Fetch XML, and then we convert that to bytes and export to a local folder (or any target system) This Method is proper and should work properly, which it doss most of the time, but fails on some occasions. We have observed an issue, where we were not able to open the downloaded document. It would give below error: “There was an error opening the document. The file is damaged and could not be repaired“. This was the code that we used: private static void ExportEmailAttachments()         {             string fetchXML = @”<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’true’>                         <entity name=’activitymimeattachment’>                             <attribute name=’filename’ />                             <attribute name=’body’ />                                   <filter type=’and’>                                     <condition attribute=’filesize’ operator=’gt’ value=’0′ />                                     <condition attribute=’filename’ operator=’not-null’ />                                                                   <link-entity name=’email’ from=’activityid’ to=’objectid’ alias=’ac’>                                     <attribute name=’subject’ />                                     <attribute name=’regardingobjectid’ />                                     <attribute name=’activity />                                     <order attribute=’subject’ descending=’false’ />                                     <filter type=’and’>                                         <condition attribute=’regardingobjectid’ operator=’not-null’ />                                         <condition attribute=’modifiedon’ operator=’last-x-months’ value=’3′ />                                                                 >”;             string FolderPath = @”D:\Attachments\”;             EntityCollection allEmailAttachments = crmSvc.RetrieveMultiple(new FetchExpression(fetchXML));             foreach (Entity mimeAttachment in allEmailAttachments.Entities)             {                 string fileName = mimeAttachment.GetAttributeValue<string>(“filename”);                 if (fileName.EndsWith(“pdf”, StringComparison.OrdinalIgnoreCase))                 {                     string documentBody = mimeAttachment.GetAttributeValue<string>(“body”);                     byte[] documentBytes = Convert.FromBase64String(documentBody);                     File.WriteAllBytes(FolderPath + fileName, documentBytes);                 }             }         } Solution: We triel lot of methods and various ways to solve, but we found the document was not opening properly. This is what we observed: The issue does not happen with all the files It only happens with large files Observed that the document body from CRM is always exactly 2000 characters From the above, we got to know that CRM is not sending all the document body in the Fetch XML response. We were able to solve the above by removing the “distinct=’true’“. We don’t know how it affects the query, but this was the resolution which worked for us. It is strange, but this fixed the issue. This is the final Fetch XML.             string fetchXML = @”<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’true’>                         <entity name=’activitymimeattachment’>                             <attribute name=’filename’ />                             <attribute name=’body’ />                                   <filter type=’and’>                                     <condition attribute=’filesize’ operator=’gt’ value=’0′ />                                     <condition attribute=’filename’ operator=’not-null’ />                                                                   <link-entity name=’email’ from=’activityid’ to=’objectid’ alias=’ac’>                                     <attribute name=’subject’ />                                     <attribute name=’regardingobjectid’ />                                     <attribute name=’activity />                                     <order attribute=’subject’ descending=’false’ />                                     <filter type=’and’>                                         <condition attribute=’regardingobjectid’ operator=’not-null’ />                                         <condition attribute=’modifiedon’ operator=’last-x-months’ value=’3′ />                                                                 “; Anyone, who can tell why this is the behavior, please feel free to comment below.

Share Story :

Deprecated Feature in D365 Customer Engagement – July Release (v9)

Introduction: “Deprecated” means Microsoft intends to remove the feature or capability from a future major release of Dynamics 365. The feature or capability will continue to work and is fully supported until it is officially removed. This deprecation notification can span a few years. After removal, the feature or capability will no longer work. Microsoft notifies the Customers and Developers well in advance so that they have sufficient time to take action and update the code. Consolidated list of Deprecated Features in July 2017 release of D365 for Customer Engagement: Click on each of the link for details on Microsoft Official documentation site: Dynamics 365 for Outlook (Outlook client) is deprecated Service scheduling in Dynamics 365 for Customer Service is deprecated Dialogs are deprecated Usage of Parature knowledgebase as the Dynamics 365 knowledge management solution is deprecated Project Service Finder app is deprecated Contracts, Contract Line Items, and Contract Templates entities are deprecated Standard SLAs in Dynamics 365 for Customer Service are deprecated Relationship Roles are deprecated Mail Merge is deprecated Announcements are deprecated Ready-to-use business processes available through Add Ready to Use Business Processes setting are deprecated Some client APIs are deprecated – Details of APIs deprecated with their replacements in the link. EntityMetadata.IsInteractionCentricEnabled property is deprecated Silverlight (XAP) web resource is deprecated We will keep posting more on the details and alternatives for each feature above.

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange