Filter a Lookup Field on New Form Using PowerApps.
Introduction: In this blog, we will learn how to filter a Lookup Field on the New Form. Use Case: We have a requirement where there is a Lookup Field on the form, which should only show those values whose Status is Active. Steps: 1. This is the form of Quote Product. We want to filter the Existing Product field. 2. To filter the field, click on the Combo Box. Items property: Set ExistingProduct.Items = Filter(<Data Source>,Status = <Field Name>.Active) For eg: ExistingProductQPEditForm.Items = Filter([@Products],Status = ‘Status (Products)’.Active) Conclusion: Hope the above Blog helps you to filter a Lookup Field on the New Form.
Share Story :
Nested Filters in PowerApps.
Introduction: In this blog, we will learn how to use Nested filters in PowerApps. Use Case: We have a Gallery(GalleryQuoteLineDetail) where we need to put filter which equals Quote Product selected in another Gallery. Once we get those Quote Products, we need to filter the Gallery(GalleryQuoteLineDetail) based on ‘Transaction Type’ Field, which is a field on Quote Product. The ‘Transaction Type’ should be equal to “Project Contract”. Solution: Steps to be followed: 1. Below is the CDS Data Source, we want to filter. 2. To filter the Gallery Based on another Gallery, Use the below Formula: Items property of Gallery: Set: GalleryQuoteLineDetail.Items: Filter( ‘Data Source’,Condition) For eg: GalleryQuoteLineDetail.Items : Filter(‘Quote Line Detail’,’Quote Line’.’Quote Product’ = GalleryQuoteLine.Selected.’Quote Product’) 3. To filter the Gallery Based on “Transaction Type”, Transaction Type is of Option Set Data Type, Use the below Formula: Items property of Gallery: Set: GalleryQuoteLineDetail.Items : Filter( ‘Quote Line Detail’, ‘Transaction Type’ in “Project Contract” ) 4. To Combine both the Filters in a single Formula, use the first filter as ‘Data Source’ of the second filter: Following is the formula: Filter( Filter (‘Quote Line Detail’, ‘Quote Line’.’Quote Product’ = GalleryQuoteLine.Selected.’Quote Product’ ), ‘Transaction Type’ in “Project Contract” ) Conclusion: Hope this Blog helps you to combine multiple Filters into single Filter.
Share Story :
Filter Gallery based on lookup field (Combo Box) on EditForm
Introduction: In this blog, we will learn how to filter Gallery based on Combo Box which is on different form. Use Case: We have a requirement where there is a lookup field (Price List) on the Editform (Data Source: Quote Project Price List). When there is data in the lookup field the Gallery (Data Source: Role Price) should be filtered. Steps: 1. We have an Screen which is divided into two parts:(Edit Form + Gallery) a. Quote Project Price List Edit Form. b. Gallery with Role Price data source. 2. Add field into the Editable Grid (Gallery). 3. The Lookup Field on the EditForm is PRICE LIST on which the gallery is suppose to be filtered. 4. To filter the Gallery set the Items property of the Gallery to the following formula, Item property: Set Gallery.Item = Filter(‘Gallery Data Source’, ‘GalleryFieldName’.Name = ‘Form Lookup Field Name(Combo Box)’.Selected.Name) For eg: GalleryRolePrice.Item=Filter(‘Role Prices’, ‘Price List’.Name=PriceListLookup.Selected.Name) 5. Output of the screen, The Gallery is not visible as the Lookup Field (Price List) is not selected. 6. After selecting the Lookup Field (Price List), the gallery is visible and also filtered on the basis of the selected field. 7. In this way the Gallery will get Filtered on the basis of the Lookup field on the EditForm.
Share Story :
Add lookup fields in an editable grid using PowerApps
Introduction: We had a requirement where we wanted to show the editable grid in power apps. The fields which are suppose to show are of string, decimal and lookup. Other data type was easy to display but we find difficulties in showing the lookup value. In this blog, we will learn how to add lookup fields(combo box) into the editable grid and also save it in Dynamics 365 CRM. Steps: 1. Insert Gallery : Insert a new gallery – Insert > Gallery > Blank Vertical Add Data Source to the Gallery Go to Properties > Click Data Source you want. 2. Add Combo Box input control in the PowerApps Grid. I have added 3 Combo Box input control inside the Grid, 2 text box, 1 is currency field in the data source and a Save icon. 3. For each Combo Box input box: Item Property: Set ComboBox.Item = Choices([@’Data Source’].<Field Name>) For eg: RoleComboBoxRP_1.Item = Choices([@’Role Prices’].Role) DefaultSelectedItems property: Set ComboBox.DefaultSelectedItems = ThisItem.<Field Name> For eg: RoleComboBoxRP_1.DefaultSelectedItems = ThisItem.Role 4. For each text input box: Default property: Set TextInput.Default = ThisItem.<Field Name> For eg: DescriptionRP_1.Default = ThisItem.Description Note: Do not forget to set the <DefaultSelectedItems> properties or else the value wont be visible in the grid. 5. To Save the changed value into the Data source, set the Save Icon to the following: OnChange property: Set SaveIcon.OnChange = Patch(DataSource, ThisItem, { <fieldName>: TextInput.Text, <fieldName>:ComboBoxName.Selected, <fieldName>:Value(CurrencyTextInput.Text) }) For eg: SaveRP_1.OnChange = Patch([@’Role Prices’], ThisItem, { Role : RoleComboBoxRP_1.Selected, ‘Resourcing Unit’:ResourcingUnitComboBoxRP_1.Selected, Unit:UnitComboBoxRP_1.Selected, Description:DescriptionRP_1.Text, Price:Value(PriceRP_1.Text) }) 6. The Output Screen. 7. The changed Lookup value. If you click the Save Icon the changed values will be saved. In this way we can change the Lookup values and also Save the changed value in the Dynamics 365 CRM.
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,@”•”, ” * “,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 :
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 :
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