Thursday, 21 September 2023

Remove Html Div tags from comments and save in another field - Dynamics CRM

 CODE: 

function onChangeComments(executionContext) {
var formContext = executionContext.getFormContext();
var new_comments = convertToPlain(formContext.getAttribute("new_comments").getValue());

 

formContext.getAttribute("new_copycomments").setValue(new_comments);
}

 

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 || "";
}

No comments:

Post a Comment

Flow: how to change the style of your HTML table in Microsoft Flow

I built an HTML table in Flow and now I want to change its style. I want to add CSS style to the table rows. If we look at the  Data Operati...