Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

any way to set form header field values with xrm?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello - I'm trying to set a header field value on my case form with xrm.  However, Xrm doesn't seem to pick up the field reference, because it's in the header. Is there a workaround for getting and setting field header values?  Or is this not possible with CRM?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: any way to set form header field values with xrm?

    for such situation.. the field which is on header in the CRM form.. should be added in the form body also (so now on form the same field will be on two places)... and update the field (which is on body) by javascript (to update you can use the Xrm object like this Xrm.Page.getAttribute("fieldname").setValue('xyz')).... you will see that on update the header field will also get updated... this is totally a supported method... today I was stuck in the same situation and  then found this solution.. :).. you can hide that field on form body..

    I know it is very late response to this post... but will help anyone :)

  • Mohsin Ali Profile Picture
    Mohsin Ali 3,614 on at
    RE: any way to set form header field values with xrm?

    Andrew, Its late but hopefully it'll help others.

    dynamicscrm2011blogs.blogspot.com/.../how-to-set-header-field-value-in.html

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: any way to set form header field values with xrm?

    You can add the field to the form and make it invisible to the form that the user sees.

  • CList Profile Picture
    CList on at
    RE: any way to set form header field values with xrm?

    The workaround you're looking for is the following bit of javascript:

    ...if the header field you want to set is called "XXX"...

    document.getElementById("header_XXX_d").firstChild.innerHTML = 'blah blah blah';

    ...IE development tools (F12) are your friend!

    The key thing here is that this is UNSUPPORTED - the question is; is that a bad thing?

    Because CRM is simply a .Net web application, like any other .Net web application (though a rather large and fancy one), almost anything is *possible*, it's just not *supported*.

    That means that when it's time to upgrade, you may have to figure out a new workaround. In my experience, this is a balancing act of effort now vs effort later, but I've found that doing a quick elegant workaround now and then figuring out how to do it again in 4 years when a new release comes out often takes less time than jumping through hoops to create a less-than-optimal UI experience in some "supported" way.... especially since that "supported" way may still break when a new release comes out - as many of us experienced when we upgraded from CRM 4 to CRM 2011 and saw changes to many of the old documented APIs.

    Cheers!

    C.List

  • Verified answer
    jlattimer Profile Picture
    jlattimer 24,558 on at
    RE: any way to set form header field values with xrm?

    There isn't a supported way to handle this with Xrm methods. A supported option would be to use an HTML web resource with some JavaScript either in the page itself or have the web resource accept the values.

    Sample: Pass Multiple Values to a Web Resource Through the Data Parameter

    Showing related information in a CRM 2011 form

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans