web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Copy and paste rich text field to simple multi line field

(0) ShareShare
ReportReport
Posted on by 53

We have a business requirement that we need to move data from a multi-line rich text field to a simply multi-line text field.  I have tried using Power Automate to move the data but the HTML comes through into the simple multi-line text field. I am thinking we need to use javascript to do this.  Here is what i currently have (definitely a beginner at javascript).  This code snippet errors out with "ReferenceError: Web resource method does not exist: copyField".  Any recommendations or help would be greatly appreciated!

function CopyField(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.getAttribute("new_meetingagenda").setValue("new_timeentrydetails")
}  

I have the same question (0)
  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at

    Hi,

    Javascript is not adapted to your needs because it runs on the client side.

    Power Automate is a very good choice. You will need to remove the HTML in the rich text field. I invite you to read the following post to do it: powerusers.microsoft.com/.../731195

    For information, the javascript error you got comes from the case sensitivity of javascript. copyField vs CopyField.

  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at

    Hi AZWildcat1290,

    Maybe you need get old field firstly:

    formContext.getAttribute(arg).getValue()

    https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/attributes/getvalue 

    The code should like this:

    function CopyField(executionContext) {
    
    var formContext = executionContext.getFormContext();
    
    var details = formContext.getAttribute("new_timeentrydetails").getValue();
    
    formContext.getAttribute("new_meetingagenda").setValue(details);
    
    }

    And you can refer to the following blog to appply js code on the form:

    https://carldesouza.com/get-and-set-field-values-using-formcontext-and-javascript-with-dynamics-365/ 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 45 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans