Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Update custom field based on status change for Quote

(0) ShareShare
ReportReport
Posted on by 45

I need to update "activateQuote " field to Yes(True) if the Quote is "Active" or "Won". Can anyone tell me whats wrong with this ?

var activateQuote = Xrm.Page.getAttribute("new_activatequote").getValue();

var quoteStatus = Xrm.Page.getAttribute("statecode").getText();
if ((quoteStatus == "Won") || (quoteStatus == "Active")) {
Xrm.Page.getAttribute(activateQuote).setValue(true);
}

*This post is locked for comments

  • Sai Ankith MCP Profile Picture
    45 on at
    RE: Update custom field based on status change for Quote

    Thanks for reviewing my code Aric.

  • Sai Ankith MCP Profile Picture
    45 on at
    RE: Update custom field based on status change for Quote

    Awesome ! The workflow worked(Used Real-time).. You are Awesome Fun Wei Hie..

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Update custom field based on status change for Quote

    Hi,

    if the quote is won or closed or active, the field will become read only, perhaps you can go for workflow / plugin in this case. Please consider the trigger point and the proper checking conditions, because it might fall into infinite loops if does not handle well enough.

    https://edwardsdna.com/2009/09/01/updating-a-crm-record-when-the-record-is-in-a-read-only-state-such-as-closed-or-completed/

  • Sai Ankith MCP Profile Picture
    45 on at
    RE: Update custom field based on status change for Quote

    Ahhhh.... I tried that but still does not work. Is it because once the Quote is turned "Active" or "Won" all the fields are read-only?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: Update custom field based on status change for Quote

    You issue is with the setValue line:

    Should be:

    Xrm.Page.getAttribute("new_activatequote").setValue(true);

    You can also do:

    var activateQuote = Xrm.Page.getAttribute("new_activatequote");

    var quoteStatus = Xrm.Page.getAttribute("statecode").getText();

    if ((quoteStatus == "Won") || (quoteStatus == "Active"))

    {

      activateQuote.setValue(true);

    }

    Hope this helps.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans