D365 General Archives - Page 3 of 30 - - Page 3

Category Archives: D365 General

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 :

How to map Signature field into Word template

Introduction : As we know , signature field with pen control can not be mapped directly into word template. This blog will explain how to map  signature field into word template. Implementation : Steps to Add Signature Field Step 1 :  Create signature Field with data type multiple line of text and maximum length 15000   Step 2:  Then in the field properties -> control -> select Pen Control and Add. In word template ,signature field will map as a text field which contains base 64 separated by comma. As shown below. Steps for resolution: Step 1 : To map signature field in picture format in word template , create new field signature text with data type multiple line of text and maximum length 1048576.     Step 2 : Write plugin. Plugin will trigger on create of record and update of signature field. Plugin Explanation : Plugin will retrieve the value of signature and separate  ” data:image/png;base64 ” string followed by “,” (comma) and save remaining text in newly created signature text field.   Plugin Registration: Register a plugin on create and update of account entity     2.Plugin Code void SignatureUpdate(Entity account) { tracingService.Trace(“postmsg : ” + account); string signaturetext = string.Empty; string attributeToUpdate = string.Empty; Entity AccountUpdate = null; try { AccountUpdate = new Entity(); AccountUpdate.Id = account.Id; AccountUpdate.LogicalName = account.LogicalName; if (account.Contains(“new_signature”) && account[“new_signature”] != null) { signaturetext = account.GetAttributeValue<string>(“new_signature”); attributeToUpdate = “new_signaturetext”; AccountUpdate = ProcessSignature(signaturetext, AccountUpdate, attributeToUpdate); } service.Update(AccountUpdate); } catch (Exception) { throw; } } public Entity ProcessSignature(string signaturetext, Entity Account, string attribute) { //to split base64 and remaining text string[] substring = signaturetext.Split(‘,’); Account[attribute] = substring[1]; return Account; } 3. build the code and update assembly and trigger a plugin And upload this template . Result :

Share Story :

How to run your SSRS Report for Past “N” Days from the Report run Date

Introduction If have a parameter on our report to see the past “N” days data on our report, we can perform the following steps. Step 1: Add a new Parameter, say “Days” Step 2: Under the Available Values Section, Add a new Value for the Parameter with value as 7 and expression having the following formula: =DateAdd(“d”,-7,Globals!ExecutionTime) Step 3: Under the Default Values Section, Add a new Value for the Parameter with expression having the following formula: =DateAdd(“d”,-7,Globals!ExecutionTime) Step 3: In your Dataset, add the following Filter Condition in the XML. <filter type=”and”> <condition attribute =”modifiedon”  operator=”on-or-after” value=”@Days” /> </filter> Conclusion Thus, now you can view your report with records modified in the past “N” days.

Share Story :

D365 General Tip: Currency field affects PriceList field

In a hurry, you perhaps selected a similar looking Price List on your Quote and you want to change it. Example: By mistake, I have selected “SalesPriceListINR” and want to select “SalesPriceListUS” But when you try to do this, you can’t see the PriceList you want to set. Why is that? Currency That’s because the Currency selected on the record is Rupee (₹) and your PriceList has the currency US Dollar ($) Change it to US Dollar and you’ll see your PriceLists show up. And try searching your Price Lists again Error while changing PriceList In a typical scenario, if you have child records dependent on the record you are changing, you’ll see this error. But as simple as the wordings are, you’ll need to do the needful and make sure there are no Currency dependent records associated. Hope this helps!    

Share Story :

How to Attach Word Template to Notes of record Automatically

Introduction: In this blog, we will look into How to Create Word Template Automatically and attach it to Notes. Steps to attach Word Template Using Workflow Navigate to Solution > Processes > Click on New > Enter your Process name, Select Workflow as your Category, Enter your Entity (Account), Check the button (Run this Workflow in the background) > Click on OK I have created a Custom Field as Status. I want this workflow to run when this field is updated, So Check the Record fields change > Select the Status Field State the condition on which you want to trigger the workflow. Select Perform action > Select Action(Set Word Template) > Click on Set Properties Select your Word Template in “SelectedTemplate” and in Target select the “Entity”. If you cannot set Entity Name in “Target” make sure “Business process flows” properties of that entity is enabled. Save the Word Template Activate the Workflow. Output: Update the Status field Automatically the Note is created with word template

Share Story :

Notes attachments in Word Template

Introduction : This blog explains how to add notes attachments in word template. Implementation : Let say we have word template on the account entity and we want to add attached notes in word template. Step 1: a. Create record( if no record is there) for an account entity. b. Select the record and download the word template.   Step 2 : Select  notes- annotation(1:N) relationship and Download. Step 3 : Open Word Template, Navigate to  “Developer” ->Select “XML Mapping Pane” -> Select entity . Step 4 : Then insert a table in the template , here inserting 2×1 table. and then in the XML mapping, go to Account_Annotation relation. Step 5: Map document body and note text a. For text in word template, left-click on the note text and select plain text.   b.For the image in word template, left click on the document body and select Picture. Step 6 : Save and Upload the Template. To upload the Template  – a. Go to advanced settings ->  navigate to “Template”. b. In Templates, Select Document Template. c. In Document Template, click on Upload Template and browse. d. Upload.

Share Story :

How to Replicate D365 View using XRM Tool

Introduction: In this blog we will look into How to Replicate your View to all the Views   Steps: Navigate to Solution > Expand the Entity (Account) > Views > Click on Quick Find Active Account Click On Add View Columns3. You can Add fields for the view based on what you want to view.4. You can modify the width by clicking on the column name and then click Change Column Properties. Choose the quantity of pixels you’d just like the width of the column to seem as in the view.5. Click on Save And Close and  then Publish your Customization Replicate View to all other Views Together To Copy the views Start Your XRM toolbox > Connect to your organization. Search View Layout Replicator Click on Load Entities > Click on your Entity (Account) > Click on Quick Find Active Accounts. Check all your customization’s are correct, Then select all the views which you want to get reflected Save and Publish your View

Share Story :

How to use System.Text.Json APIs in Asp.net

Posted On November 25, 2019 by Admin Posted in

Initially for parsing object to Json or json to object in Asp.net an additional Newtonsoft.Json Api was required, but now Microsoft has developed their own Apis “System.Test.Json”. Below Steps will guide you on how to use this api. Install the System.Text.Json NuGet package. To use the api make sure you import the following two namespaces: using System.Text.Json; using System.Text.Json.Serialization; Using the serializer as follows: The System.Text.Json serializer can read and write JSON asynchronously and is optimized for UTF-8 text, making it ideal for REST API and back-end applications. class WeatherForecast { public DateTimeOffset Date {get; set;} public int TemperatureC {get; set;} public string Summary {get; set;} }   string Serialize (WeatherForecast value) { return JsonSerializer.ToString<WeatherForecast>(value); } Api also support asynchronous serialization and deserialization. async Task SerializeAsync(WeatherForecast value, Stream stream) { await JsonSerializer.WriteAsync<WeatherForecast> (value, stream); } You can also use custom attributes to control serialization behavior, for example, ignoring properties and specifying the name of the property in the JSON: class WeatherForecast { public DateTimeOffset Date {get; set;}   // Always in Celsius. [JsonPropertyName(“temp”)] public int TemperatureC {get; set;}   public string Summary {get; set;}   // Don’t serialize this property. [JsonIgnore] public bool IsHot => TemperatureC >= 30; } Note: In the above point isHot property will not get parsed to json and json will look like below:      { “date”: “2013-01-07T00:00:00Z”, “temp”: 23, }

Share Story :

SEARCH BLOGS:

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :