Category Archives: Dynamics CRM
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,@”•”, ” * “,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”‹”, “<“,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”›”, “>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”™”, “(tm)”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result, @”⁄”, “/”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”<”, “<“,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”>”, “>”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”©”, “(c)”,System.Text.RegularExpressions.RegexOptions.IgnoreCase); result = System.Text.RegularExpressions.Regex.Replace(result,@”®”, “(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 :
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 :
Find hidden entities in CRM using Metadata Document generator from XRM ToolBox
Problem Statement: I had a requirement where I needed to check the fields on the Entity POST, however in CRM customization, I could not find the entity POST though it was visible in advanced Find. Solution: To view all the data related to any hidden field, you can use the Metadata Generator in XRM Toolbox Connect to your environment on XRM Toolbox. Search for Metadata Document Generator In Metadata Document Generator: Retrieve Entities and languages Select the entity you want to generate metadata for and enter the file path of the excel document where the data needs to be stored. Generate Document 4. Open the document, you will be able to see all the data related to the Entity. Conclusion: XRM Toolbox- Metadata Generator is helpful in case the entity cannot be viewed in CRM.
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 create AX (D365 F&0) Connection in SSIS
Introduction: Creating a Connection is one of the first Steps during integration of data. While performing Integration with AX or more specifically Dynamics 365 for Finance and Operations create a connection using the following steps. Step 1: Right Click on Connection Managers and click on New Connection Manager. Choose the Dynamics CRM option. Step 2: Choose the SOAP 2011 Option for Service Endpoint option. Step 3: Choose the Online Federation for Authentication Type option. Step 4: In the CRM Discovery Option copy the endpoint address from Settings > Customizations > Developer Resources > Copy Endpoint Address. Step 5: Paste this in CRM Discovery Section. Enter the Username and Password of your CRM account. Step 6: Choose the required organization from the dropdown. Step 7: Click on Test Connection and then OK after successful testing. Conclusion: Thus we have successfully created a connection with Dynamics CRM and we can now Integrate data using it a source /destination.
Share Story :
Entity Relationship Behavior in D365 CRM
Problem Statement: When a user changes the owner of Lead (either because the original owner has left the company or the lead is being assigned to a new salesperson), the system changes the owner on COMPLETED activities to the new owner of the record. This is a problem because it is important that we maintain the history as to who performed each task that happened in the past and by switching the owner for completed tasks this changes all historical reporting and records. Solution: This kind of situation can be easily handled by using the relationship behavior feature in D365 CRM. Create a new solution->> add the Activity Entity for which you need to make this change. (in below example I have added the Email entity). When you open the relationship, you will notice that the behavior is set to Parental. Parental Relationship: In this relationship all changes on parent record are reflected on child record. Change the type of Behavior to Configurable Cascading. This will enable the Assign\Share\Unshare\Reparent actions which were earlier set to Cascade All as the relationship was Parental. 4. For our problem Statement where we will be making changes to owner, we will be using changing the Assign Action. Below are scenarios handled by Assign Action in relationship feature (On Change of owner) Scenario 1:Cascade-None: No change will be done to existing Activities and Notes. No change on Child will be done if Change in Parent. Scenario 2:Cascade-Active: Only Open Activities will be updated to the new owner and date changed to date of change of owner. This option is not available for Notes, as notes are always active. Scenario 3:Cascade-All: Changes on the parent will be done on the Child. Scenario 4:Cascade-User-Owned: Changes on parent will be reflected on child records owned by the same user. As for our requirement, we will make it cascade active(Scenario 2) Below is an example for the same. a. Before Change of Owner, we can view the last updated Datetime of activity.b. After Change of Owner, we can view the last updated datetime of activity. As desired, The Date-time and owner is updated for open activity. (Since I have tried all the cascade options on the same Date, in my example you will be able to see change of time and not Date). Conclusion: By using the relationship behavior feature, we can maintain historical data even on changes done to parent record (change of Owner).
Share Story :
How to create a Gantt Chart or Progress bar inside a Table in SSRS
In this article, we will create a Gantt Chart or Progress bar inside a table in SSRS . In SQL Server Reporting Service does not allow a report programmer to modify a “width” property at run time. The challenging part of this task is how to create a scale and how to create a progress bar that spans a start date and end date. But SSRS have a range bar chart that will help you to make a Gantt chart or progress bar. And display diamond shape if start date and end date is same. For creating Gantt chart, we need a Data source, a Dataset, a Table and a Range Bar chart. Steps Step 1: First create a new data source. Step 2: Before creating a data set, we need to write a Fetch XML query that created the data we’re going to work with. Fetch XML Query: <fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”> <entity name=”milestone”> <attribute name=”createdon” /> <attribute name=”item” /> <attribute name=”projectid” /> <attribute name=”contractorid” /> <attribute name=”packageid” /> <attribute name=”startdatemilestone” /> <attribute name=”remarks” /> <attribute name=”finishdatemilestone” /> <attribute name=”startdateforecast” /> <attribute name=”finishdateforecast” /> <attribute name=”startdateactual” /> <attribute name=”finishdateactual” /> <attribute name=”progress” /> <attribute name=”status” /> <attribute name=”durationdays” /> <attribute name=”sequencenumber” /> <attribute name=”milestoneid” /> <order attribute=”item” descending=”false” /> <filter type=”and”> <condition attribute=”projectid” operator=”eq” uiname=”ABC” uitype=”pmtracker” value=”{86AF05D9-6962-E911-A834-000D3A07F3D7}” /> </filter> </entity> </fetch> This gives us a result set like this : Sequence Number Item Package Start Date(Milestone) Finish Date(Milestone) Start Date(Forecast) Finish Date(Forecast) Start Date(Actual) Finish Date(Actual) Duration(Days) Status 1 Concept Design Lighting 02-01-2019 06-02-2019 03-01-2019 09-02-2019 03-01-2019 09-02-2019 37.00 Completed 2 Concept Design approval Lighting 13-02-2019 13-02-2019 07-02-2019 14-02-2019 07-02-2019 13-02-2019 6.00 Completed 3 Detail Design Lighting 14-02-2019 17-04-2019 14-02-2019 17-02-2019 14-02-2019 18-02-2019 4.00 Completed 4 Detail Design Approval Lighting 17-04-2019 23-04-2019 17-04-2019 24-04-2019 17-04-2019 22-04-2019 Delay 5 Tender Issue Lighting 29-05-2019 31-05-2019 01-06-2019 03-06-2019 01-06-2019 03-06-2019 Delay 6 Tender Return Lighting 31-05-2019 22-06-2019 03-06-2019 03-06-2019 03-06-2019 24-06-2019 21.00 Completed Step 3: Now we create a Data set from this query: If start date and end date is same then need to display diamond shape, for that we have to add three calculated field. Need to find number of days between two dates. DayDiff_MileStone=DateDiff(“d”,Fields!startdatemilestoneValue.Value,Fields!finishdatemilestoneValue.Value) we are going to set the following properties: We’re going to create a table within the report that has a column for each of the columns in the data set, plus a column for a graph. We just have to bind the Table to the data set “MilstoneData” Then drag the columns of the data set to the columns of the table. Step 4 : Build the Gantt Chart SSRS have the Range Bar Chart option. Just drop the chart onto a blank area of the report. We’ll fit it into table later. Now we are going to take fewer part of the chart. We’re throw away of: The chart title The legend The vertical Axis title The vertical axis The horizontal axis title When we’re done, the chart should look like this: Let’s start setting up the chart. The first thing we need to do is set the Minimums, Maximums, Intervals and Interval Types. The client wants minimum date must be from “startdatemilestone” date and maximum date should be “finishdateforecast” date. On the Horizontal Axis, we are going to set the following properties: Minimum =DateSerial(Year(Min(Fields!startdatemilestoneValue.Value, “MilestoneData”)), Month(Min(Fields!startdatemilestoneValue.Value, “MilestoneData”)), -1) Maximum =DateSerial(Year(Max(Fields!finishdateforecastValue.Value, “MilestoneData”)), Month(Max(Fields!finishdateforecastValue.Value, “MilestoneData”)) , 0) Interval 1 Interval Type Months Also going to set the format the of items along the Horizontal Axis to MM-yyyy Go to chart series properties, set Marker properties. Let’s get a preview of the report and see how we’re doing. It’s correct, but it doesn’t provide the milestone data. Now cut the chart and paste it into the details row of the Table, in the right most column. Now we’re going to run a preview. OOPS! We receive the error “The chart has a detail member with inner members. Detail members can only contain static members. What this means is that chart cannot live in a detail row. We’re going to create a Group that contains only a single Item. After selecting the Table, at the bottom left of the screen, we find “Row Groups”, Just click on preview shows us: Nice-looking but do we really need a timeline on every now? Now we are going to need a timeline. So, let’s take a copy of the Chart and put it right next to the header “Duration” Now we can hide the Axis Labels on the chart in the footer. We can also change the Axis line style to none. Click on preview Wow! Hope this helps you! Check out my other blog here https://www.cloudfronts.com/performing-update-operation-in-microsoft-dynamics-nav-through-integration-in-scribe-online/
Share Story :
How to make same record available in two different Organization / Environment? Part 2
Please refer to my previous blog better understand why the same records are required in two different Organizations or Environments. Click Here Import Phase: Login to Destination Environment in which you want to import the Data with the same GUID. In Destination Environment, Open the Entity View and click on right three dots for import options. Click on the > which is present on the right side of “Import from Excel” Click on the Import from CSV You will get the Screen like shown in below Screen and now you have to select the file and click on Next You will get the Screen as shown in the below Screenshot. Now, click on the Review mapping. After Clicking on the Review Mapping you must map the column header to fields of Entity. Now, here comes the most important of this blog. Here you have a map the column which has the GUID of the entity to Entity name present in the Destination Environment. Here I have mapped Customer Header (having GUID) to Customer (Entity Name). You can ignore the mapping of “Created On” Date or else you can map it will “Record Created On”. Click on the Finish Import and see the magic. All the Data will be imported with the same GUID as of source Environment. You can see the imported data in the following screenshot. To check whether the GUID of records present on both the Environment is the same or not. Just export data from both the Environment and match the GUID of each record. Below you can see the GUID of imported and exported records are the same. Following is exported Data from Source Environment. Following is exported Data from Destination Environment.
Share Story :
How to make same record available in two different Organization / Environment? Part 1
Why it is required? Let’s discuss the scenario where we will be required to have some records in the Multiple Environment. Let’s say we have workflow or flow which is configured or running with specific records. So, if we move the flow or workflow to another organization or Instance so the same record is not available with the same GUID. To run the flow or workflow we must change the flow or workflow. Now if we have 10 – 20 flow / Workflow like the same, then it will be so much time consuming So, the best solution to have the Same records with the same GUID in multiple instances. Prerequisite: The system must have the same entity and fields present in both the system in which you must transfer records. Because it will through an error while import to destination Environment Solution: Exporting Phase: Login to Source Environment from where you want to export the Data. Open the Entity of which data needs to be migrated. You can see I have an Entity called Customer which is having a few numbers of records present in the system. Now You need to export the Data from the source Environment. Export Data from the advance find or direct from the View. After Exporting the Data from the system, an excel file will be downloaded with the same columns as in the views. Now, open the exported Data file. The following is the screenshot of the file. You can see there will hidden Columns in Excel A, B, and C. Now to Unhide the Hidden Columns, select all Data Or Press Ctrl + A and Go to Format in Home Section > Under the Visibility Section Click on Hide & Unhide > Unhide Columns. Please see the following Screenshot for more reference. Now You can see all the three Columns as (Do Not Modify) Entity Name, (Do Not Modify) Row Checksum & (Do Not Modify) Modified On. You can see the Hidden Column in the screenshot after unhiding. Let’s move forward now, we must delete (Do Not Modify) Row Checksum & (Do Not Modify) Modified on Columns because we are not required those columns while importing to another environment. If we will import with those columns it will through the error while import Operation. Change the Header from (Do not Modify) Entity_name to Entity_name for convenience while mapping during importing and Save as CSV. Now Your File is ready to import in another system. Let’s go towards the importing phase.
Share Story :
Time zone Conversion from Microsoft D365 for SSRS Reporting
Introduction: Converting Date/Time values according to a time zone is quite challenging task in SSRS Reporting. For D365 CRM online we can achieve this using CDate Function. I will demonstrate how to use CDate function with a dynamic time-zone parameter. Step 1: Add this reference to the report properties: Click on “References” and then click on “Add” button under “Add or remove assemblies”. Browse the following file from your BIDS folder. Microsoft.Crm.Reporting.RdlHelper, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Click on Ok button to save the changes. Step 2: Create the parameter in the report data section in the “Parameters” folder as shown below: In the “Default Values” section check the click on “Add” Button. Enter the User Time Zone in the Formula and click on OK to Save the Changes. Step 3: To use this functionality is simply as follows: DateValue(CDate(Microsoft.Crm.Reporting.RdlHelper.DateTimeUtility.ConvertUtcToLocalTime(Fields!msdyn_dateValue.Value, Parameters!CRM_UserTimeZoneName.Value))) Example: If the Expression or Formula is as follow: Last 30 =WeekdayName(Weekday(DateSerial(Year(Fields!msdyn_dateValue.Value), Month(Fields!msdyn_dateValue.Value),”1″).AddMonths(1).AddDays(-30))) The Replace it with: Last 30= WeekdayName(Weekday(DateSerial(Year(DateValue(CDate(Microsoft.Crm.Reporting.RdlHelper.DateTimeUtility.ConvertUtcToLocalTime(Fields!msdyn_dateValue.Value, Parameters!CRM_UserTimeZoneName.Value)))), Month(DateValue(CDate(Microsoft.Crm.Reporting.RdlHelper.DateTimeUtility.ConvertUtcToLocalTime(Fields!msdyn_dateValue.Value, Parameters!CRM_UserTimeZoneName.Value)))),”1″).AddMonths(1).AddDays(-30))) Note: This is an easy way of dynamically converting a time zone from UTC to the user’s local time using CRM Online. We have to replace all the formulae which contain the DateTime field value which is retrieved directly from FetchXML with the above mentioned Function to avoid issues in SSRS reports due to Time Zone Conversion.