Requirement: Extract text out of rich text editor control text on a Dynamics 365 CE Record form.
Here is the script for this example (written on change event):
function onChange(executionContext)
{
var formContext = executionContext.getFormContext();
formContext.getAttribute("new_plaintextwithhtml").setValue(formContext.getAttribute("new_htmlrichtext").getValue());
formContext.getAttribute("new_texteditorcontrol").setValue(convertToPlain(formContext.getAttribute("new_htmlrichtext").getValue()));
}
function convertToPlain(html){
// Create a new div element
var tempDivElement = document.createElement("div");
// Set the HTML content with the given value
tempDivElement.innerHTML = html;
// Retrieve the text property of the element
return tempDivElement.textContent || tempDivElement.innerText || "";
}
Hope it helps!
Power 365ing as usual!
Other ways to learn with me:
Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?
Problem Area – Technical, Functional, Training, Development or consulting?
Me and my team are here to assist, please fill the following form for your business needs: Click here
Select Solution -> Open your Solution -> then Select Cloud flows from left navigation pane
Click on “New” button -> Select “Automation” -> Select “Cloud Flow” -> then select “Schedule Cloud flow”.
Give Flow Name as “Create a task 3 days before Est Close Date”.
Enter starting Date and Time when you want to run Scheduled Flow.
Enter the Duration/Time Interval (Repeat Every) you want run a flow. In this case we want it to run every day so we will select 1 Day.
Then click on Create.
Then click on “New Step”
Select the action as “List Rows”. In our scenario, we are triggering our flow to check if an Opportunity Close Date is in next 3 days, so first we retrieve records of opportunities which will be closed after 3 days.
Rename the trigger action as “List Opportunity which close in 3 days”.
Select “Opportunities” under Table name.
Add Fetch XML of Opportunity Entity under Fetch XML Query.
Then click on “New Step”.
Now, add “Apply to each” Condition from Choose an operation -> Control.
After Select Apply to each Condition, select an output from previous step as VALUE from List Opportunity as shown below.
Then click on “Add Action” for Creating a Task.
Then Add a Dataverse Trigger “Add new Row” for Creating a new Task.
Select “Task” under Table name.
Select “Topic” which is Opportunity Name from dynamic content under Subject as shown below.
Add “opportunities(Opportunity GUID)” under Regarding(Opportunities) field, which is Look-Up field in Task.
For creating a Assistance Insight Card, Select Create Card for Assistance v3 Action as per below Image.
After Selection Create Assistance card action, fill all required fields as per following Image.
Select Environment Which we use form drop-down menu.
Enter card name which we display on Insight card.
In Card Header section, Write Header for the Card using Task Topic.
In Card Text, we write detail message for card.
In Primary Action type we select Option which u want to perform, in our case we select Open record.
In Primary Action text we write short message which is show in pop up format.
In Primary Action entity type we select entity on which we require to display a Assistance Card.
In Primary Action record ID type we select entity on which we require to display a Assistance Card.
Then Save the flow and Test flow by selecting Manual Test.
OUTPUT:
Now, check record whose Est. Close Date is after 3 days from today, for which Task should be Created in Timeline of that Opportunity record.
Now we will Open Form (as shown in highlighted square logo)
After Opening a Task Record, we can see data is auto populated which we added into the flow along with Subject and Regarding Lookup field.
After Opening Assistant It gives notification and Insight Card for Opportunity Entity Record which is Closed In next 3 days.
Hope it helps!
Power 365ing as usual!
Other ways to learn with me:
Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?
Problem Area – Technical, Functional, Training, Development or consulting?
Me and my team are here to assist, please fill the following form for your business needs: Click here