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

Category Archives: Dynamics 365

What is “Does not support untyped value in non-open type” ODataException in creating records in D365 CE?

One of the most common errors we come across while calling API to create records in Dynamics but isn’t clear what it means? One such issue is – “An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.” On the console of the browser, you’ll see this – But, if you open the <objectName>.responseText of the Failure message of the call, you’ll see the below – A more zoomed view of the error would be below – This is because of my typo in the code [Which is the case for most scenarios] where you mistype a name of the field and neither does the error itself doesn’t specify which field you’re missing out on nor what it means! Reason This is because of a simple typo  in one of the fields in the object I was creating using AJAX In my case, this should have been “entity.duration” and not “entity.durationn“. It was a simple issue which led me wander troubleshooting in areas which I shouldn’t look into. Hope this saves you some valuable time! Happy 365ing!

Share Story :

How to use Expand Query in MS Flows

Introduction This blog explains how to use Expand Query (N:1 Relationship) in the Common Data Service List Records Connector. Steps to be followed: Initialize Variable of type string. Using Expand in list RecordsExpand Query: cf_Project($select=cf_projectname,cf_projectabbreviation) Here cf_Project is the Schema Name of Project Lookup field on location entity. Pass the field names of the project entity that  you want. Here I have passed cf_projectname and cf_projectabbreviation. Result of list record: You can see we get Project value in the below format to use this we have to parse the JSON. “cf_Project”: “{\r\n \”cf_projectname\”: \”Client Commercial\”,\r\n \”cf_projectabbreviation\”: \”CC\”,\r\n \”cf_pmtrackerid\”: \”3b576605-9c82-e911-a839-000d3a07f695\”\r\n}” Retrieving Project Values. Use “Apply to each” to get the value of the Project. Pass “Value” of “List Records” from Dynamic Content in “Select an output from previous steps” Now Set the Value in the “Project” variable which we had initialized earlier. Go To Expression and type: items(‘Apply_to_each’)[‘cf_Project’] Note: Here “cf_Project” is what we had retrieved in the output of ‘list records’. Make sure you pass this value correctly. “cf_Project“: “{\r\n \”cf_projectname\”: \”Client Commercial\”,\r\n \”cf_projectabbreviation\”: \”CC\”,\r\n \”cf_pmtrackerid\”: \”3b576605-9c82-e911-a839-000d3a07f695\”\r\n}” Result of Project Variable: Parsing JSON. Use “Parse JSON” action Add “Project Variable” in Content from “Dynamic Content” Click on “Generate from sample” to generate JSON Schema Enter sample JSON payload and click on done. { “cf_projectname”: “Test Project”, “cf_projectabbreviation”: “TR”, “cf_pmtrackerid”: “3b576605-9c82-e911-a839-000d3a07f695” } It will generate a JSON Schema automatically. Using Project Values. After parsing Json successfully you can use the values of the project entity field. You can use “Compose” to get and check the value. Enter “cf_projectname” in “Compose” inputs. OutputEntire FLOW: NOTE:  You can add multiple expand queries in List Record:Query: cf_Project($select=cf_projectname,cf_projectabbreviation),cf_ParentLocationId($select=cf_name)

Share Story :

Conversion of Time and Date in MS flow

Introduction We had a requirement where we wanted to create a price list with current date time with respect to current country. In this blog we will use the OOB date conversion functionality. Use Case : (UTC with ) We created a flow where we had used UTC now functionality but this was returning the value time value with -5.30 hours. After doing RND I come to know that it automatically adjust the time using our time zone. As you can see in the below screen shot.   Solution: To over come with this issue we need to use the inbuilt functionality convertTimeZone. It takes below parameter Sr No Parameters Example Explanation 1. <timestamp>     Utcnow() It is a string or function which contains the timestamp 2. <sourceTimeZone>       UTC The name for source time zone . We can write source time zone which we want to convert into 3. <destinationTimeZone>       India Standard Time The name for the target/destination time zone. In this case we want to convert UTC into India Standard Time. So the India Standard Time is a destination TimeZone   4. <format>     dd/MM/yyyy HH:mm   Its a format  in this case we wanted to convert into date and time dd/MM/yyyy HH:mm As you can see in the below screen i have converted UTC to India time zone. convertTimeZone(utcnow(),’UTC’,’India Standard Time’,’dd/MM/yyyy HH:mm’) Result: As you can see in the below screen shot it shows the date time in the mentioned format or you can say indian format. Conclusion: Hope this will help you to over come the time zone issue while working with different country time.   For more Time Zone conversion refer : https://docs.microsoft.com/en-us/previous-versions/windows/embedded/gg154758(v=winembedded.80)?redirectedfrom=MSDN

Share Story :

Share Records in D365 CRM by Code

Introduction: This blog details steps how to share entity record in D365 CRM by Code. Scenario:  We have client requirement to share record with multiple set of Users in D365 CRM based on criteria selected by User on Form and needed to be automated. Implementation Step: Below code to be developed for OnCreate of record. Create new method ShareRecords private static void ShareRecords(IOrganizationService service, Entity entity, Entity segmentUser) { var CreatedReference = new EntityReference(“systemuser”, segmentUser.Id); var grantAccessRequest = new GrantAccessRequest { PrincipalAccess = new PrincipalAccess { AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess | AccessRights.AppendToAccess, Principal = CreatedReference }, Target = new EntityReference(entity.LogicalName, entity.Id) }; service.Execute(grantAccessRequest); }   Retrieve User List of Users and execute ShareRecords method EntityCollection segmentUsers = service.RetrieveMultiple(new FetchExpression(fetchXMLUsers)); foreach(Entity segmentUser in segmentUsers.Entities) { ShareRecords(service, entity, segmentUser); } Below code to be developed for OnUpdate of record. Create new method UnShareRecords private static void UnShareRecords(IOrganizationService service, Entity entity, Entity segmentUser) { var CreatedReference = new EntityReference(“systemuser”, segmentUser.Id); var revokeUserAccessReq = new RevokeAccessRequest { Revokee = CreatedReference, Target = entity.ToEntityReference() }; service.Execute(revokeUserAccessReq); }   Retrieve existing shared Users and remove there Access private static void RetrieveSharedUsers(IOrganizationService service, EntityReference entityRef) { var accessRequest = new RetrieveSharedPrincipalsAndAccessRequest { Target = entityRef }; var accessResponse = (RetrieveSharedPrincipalsAndAccessResponse) service.Execute(accessRequest); foreach(PrincipalAccess principalAccess in accessResponse.PrincipalAccesses) { EntityReference prAcc = principalAccess.Principal; Entity entity = new Entity(entityRef.LogicalName, entityRef.Id); Entity segmentUser = new Entity(prAcc.LogicalName, prAcc.Id); UnShareRecords(service, entity, segmentUser); } } Implement code for ShareRecords explained in step 1 & step 2.   Conclusion: Hope this blog helps you to to share and unshare records by code in D365 CRM based on custom criteria data on record dynamically.

Share Story :

Calculated Field in Dynamic 365 CE

Introduction In this blog we will see how to use Calculated field. Use Case : Its common requirement of Project to set calculated date to specific date field by adding or Subtracting the no. of days. Implementation : Step 1: Let say we have date field in an Account Entity.   Step 2:  Create one more date field with data type as date with field type as calculated field. Select field type -> Calculated -> Edit Step 3: Click on Edit. and add condition. In this scenario , I want to add 3 days to the  selected date which is date created field. So the condition is if current entity date created field contains data And then add action. Save and close Result :

Share Story :

Order fulfillment notifications in Dynamics 365 Retail (Commerce)

Posted On December 27, 2019 by Admin Posted in

The order fulfillment operation in the point of sale provides a single work area in the point of sale that can be used to process orders. This includes everything from accepting the order, to marking it as shipped, or initiating store pickup. In my case we wanted a notification to appear on POS whenever a customer order is created. This is useful in a situation where the goods are stored in the store room and you want the store room person to be notified about a new order creation. This will enable him to start preparing the goods as soon as the order is created in POS. Which will be picked up by the customer later. For this to work, the front desk store worker and and the store room worker both need to have POS registers. The following setup needs to be done at HQ to enable this functionality Add order fulfillment button on POS, Enable live content on button Enable notifications for an operation  Set up a notification interval Update the POS permission1.  Add order fulfillment button on POS, Enable live content on button 2.  Enable notifications for an operation Go to Retail > Channel setup > POS setup > POS > Operations. Search for the Order fulfillment operation, and select the Enable notifications 3. Set up a notification interval Go to Retail > Channel setup > POS setup > POS profiles > Functionality profiles. In the Notification interval field, specify how often notifications should be pulled. 4. Update the POS permission Go to Retail > Employees > Workers >, under Retail tab, open the POS permissions associated with the worker. Expand the Notifications FastTab, add the Order fulfillment operation, and set the Display order field to 1. After the setup please run staff and and channel configuration jobs and you are all set. Activate/relaunch the POS On POS create a customer order and select Pick up from store option. Once the order has been created, it would appear in the notification window depending on the refresh interval Now click on order fulfillment button, you will see all the orders. They would be in the accepted state by default. Now you can mark it as Pick, Pack to process the order. If the order needs to be shipped, you will have to click on Ship and then process it Hope this helps!

Share Story :

Convert Email Body from HTML format to Text

Introduction: We had a requirement , wherein when an Email is received a Case will be created in CRM and the body of the email will be set the description of the case. However we faced a problem because the Email body was in HTML format so we have to convert it and set it as the description. Solution: We have to write a plugin in which just take the HTML part of the email and eliminate every HTML tags so that we can get the Text part of the body. Steps: Register the plugin in PostOperation  PipeLine Stage and in Asynchronous Mode. First, get the body of Email in a String variable and call the function. string description = currentRecord.GetAttributeValue<string>(Email.ATTR_DESCRIPTION); string actualDescription = StripHTML(description); 3.Then write a function to convert all the HTML Tags in the following way. private static string StripHTML(string source) { try { string result; // Remove HTML Development formatting // Replace line breaks with space // because browsers inserts space result = source.Replace(“\r”, ” “); // Replace line breaks with space // because browsers inserts space result = result.Replace(“\n”, ” “); // Remove step-formatting result = result.Replace(“\t”, string.Empty); // Remove repeating spaces because browsers ignore them result = System.Text.RegularExpressions.Regex.Replace(result, @”( )+”, ” “); // Remove the header (prepare first by clearing attributes) result = System.Text.RegularExpressions.Regex.Replace(result, @”<( )*head([^>])*>”, “<head>”, System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, @”(<( )*(/)( )*head( )*>)”, “</head>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,”(<head>).*(</head>)”, string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // remove all scripts (prepare first by clearing attributes) result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*script([^>])*>”, “<script>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”(<( )*(/)( )*script( )*>)”, “</script>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); //result = System.Text.RegularExpressions.Regex.Replace(result, //@”(<script>)([^(<script>\.</script>)])*(</script>)”, //string.Empty, // System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”(<script>).*(</script>)”, string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // remove all styles (prepare first by clearing attributes) result = System.Text.RegularExpressions.Regex.Replace(result, @”<( )*style([^>])*>”, “<style>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”(<( )*(/)( )*style( )*>)”, “</style>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,”(<style>).*(</style>)”, string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // insert tabs in spaces of <td> tags result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*td([^>])*>”, “\t”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // insert line breaks in places of <BR> and <LI> tags result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*br( )*>”, “\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, @”<( )*li( )*>”, “\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // insert line paragraphs (double line breaks) in place // if <P>, <DIV> and <TR> tags result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*div([^>])*>”, “\r\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*tr([^>])*>”, “\r\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”<( )*p([^>])*>”, “\r\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // Remove remaining tags like <a>, links, images, // comments etc – anything that’s enclosed inside < > result = System.Text.RegularExpressions.Regex.Replace(result,@”<[^>]*>”, string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // replace special characters: result = System.Text.RegularExpressions.Regex.Replace(result, @” “, ” “,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&bull;”, ” * “,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&lsaquo;”, “<“,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&rsaquo;”, “>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&trade;”, “(tm)”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, @”&frasl;”, “/”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&lt;”, “<“,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&gt;”, “>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&copy;”, “(c)”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”&reg;”, “(r)”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // Remove all others. result = System.Text.RegularExpressions.Regex.Replace(result,@”&(.{2,6});”, string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // for testing // System.Text.RegularExpressions.Regex.Replace(result, //this.txtRegex.Text,string.Empty, //       System.Text.RegularExpressions.RegexOptions.IgnoreCase); // make line breaking consistent result = result.Replace(“\n”, “\r”); // Remove extra line breaks and tabs: // replace over 2 breaks with 2 and over 4 tabs with 4. // Prepare first to remove any whitespaces in between // the escaped characters and remove redundant tabs in between line breaks result = System.Text.RegularExpressions.Regex.Replace(result,”(\r)( )+(\r)”, “\r\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, “(\t)( )+(\t)”, “\t\t”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,”(\t)( )+(\r)”, “\t\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, “(\r)( )+(\t)”, “\r\t”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // Remove redundant tabs result = System.Text.RegularExpressions.Regex.Replace(result,”(\r)(\t)+(\r)”, “\r\r”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // Remove multiple tabs following a line break with just one tab result = System.Text.RegularExpressions.Regex.Replace(result,”(\r)(\t)+”, “\r\t”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); // Initial replacement target string for line breaks string breaks = “\r\r\r”; // Initial replacement target string for tabs string tabs = “\t\t\t\t\t”; for (int index = 0; index < result.Length; index++) { result = result.Replace(breaks, “\r\r”); result = result.Replace(tabs, “\t\t\t\t”); breaks = breaks + “\r”; tabs = tabs + “\t”; } // That’s it. return result; } catch { //MessageBox.Show(“Error”); return source; } } 4. This is the Output. This is the Test Email that is been send to test. This is the email that is received in the Dynamics 365 CRM. This is the Case which is created. The description of the Case is the same as the Email

Share Story :

Suspend(Hold) and Recall a transaction in the POS in D365 Retail(Commerce)

Point of sale (POS) users can suspend in-progress transactions, and then resume them later or on a different register. Transactions are often suspended to quickly free up a register for a different task without losing any progress on the current transaction. For example, a store associate starts to process a customer’s transaction on a mobile device but must complete it on a register that has a cash drawer. In this case, the store associate can suspend the transaction on the mobile device, and then recall and resume it on a register. You can suspend a transaction by clicking on Suspend transaction button on POS and Recall it by using Recall transaction button You can void suspended transactions either by recalling the transaction and then performing the Void transaction operation, or by selecting the transaction in the Recall transaction list and selecting Void on the app bar. Alternatively, the store can be configured to prompt users to void suspended transactions when they close their shift. This can be configured from Functionality profile of the store. Hope this helps!

Share Story :

Create An Editable Grid View In PowerApps

Introduction: In this blog, we will learn how we can create an editable Grid View in PowerApps. Steps: 1.Set up a gallery in your Powerapps.     Insert a new gallery – Insert > Gallery > Vertical 2.Add Data Source to the Gallery you added.    Go to Properties > Click Data Source you want. 3.Delete the Label from the Gallery. 4.Add Text input control in the PowerApps Grid.    I have added 3 Text input control inside the Grid. 5. For each text input box: Set TextInput.Default = ThisItem.<fieldName> For eg: TextInput1.Default = ThisItem.Description 6.The output screen after adding the Default property. 7. You can change the field here. 8. To Save the changed value into the Data source, set the following: Set TextInput.OnChange = Patch(Products, ThisItem, { <fieldName>: TextInput.Text }) This will change and save the value into the CRM.

Share Story :

Secure Input/Output in Power Automate Run History

Isn’t it just too easy to see from Flow (Power Automate’s) Runs what data was passed on? A simple switch in the Power Automate designer will secure this. Default Behavior By default, if you have access to the Flow, you can simply go in and see the inputs Secure Input / Output In the Flow designer, you can select and step and go to Settings And turn on Secure Input / Output depending on what you want. It says this is still in Preview as of the day of writing this post. Once this is Active, it is denoted by a Lock symbol on the step you enabled it on. And now, when you try to look at the data, it will hide away the information Note: Please note that this will run only for the Run History records after this was turned on. The previous records will continue to show the data.   Hope this helps!!

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange