Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Xrm set attribute value gets reverted sometimes

(0) ShareShare
ReportReport
Posted on by
I need to change the value of a textarea field (that has the control of fieldControl-text-box-text), but I am running into issues.
 
As context, I am trying to do the change via a browser extension - so I don't have access to the form context.
 
Here is what I am doing:
1. If the field is focused, I insert the content directly (textareaElement.value = newContent).
2. If the field is not focused, I am using the Xrm.Page API (Xrm.Page.getAttribute(fieldName).setValue(newContent))
 
While this strategy works most of the time, it doesn't in 1 out of 10 cases.
These mainly happen when the field is not focused - when using the Xrm API.
 
In these cases, the textarea gets the new value (so Xrm.Page.getAttribute(fieldName).getValue() returns the proper new content) but then gets reverted after some milliseconds.
I have a way of detecting it - a timeout that checks after 100ms if the content is still the one I want, but no solution on how to fix it.
 
These reverts happen in the following situation: the user clicks on a word, and the focus is moved to a new area from which he clicks some text to replace the word.
 
Do you have any idea what I'm doing wrong?
Is there some period when all updates to the textarea get reverted?
Do I need to do some extra step after setValue?

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 671 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 167 Super User 2025 Season 1

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 138 Most Valuable Professional

Product updates

Dynamics 365 release plans