Wednesday, July 29, 2015

How to set header field value in Dynamics CRM form?



Setting the header field values is not supported in xrm. So, we must move to unsupported ways to set the value of the fields added in header.
Following code snippet will help us to achieve the goal.

document.getElementById("header_xxx_d").childNodes[0].innerText = value;

In the above code snippet, replace xxx with your field name that exists in the header and value with your value you need to set.

But it'll not save in the database. To achieve this you should add a hidden field on  the form and set its value when you are setting value for the header field and then at  on-load event again get the value and assign to the above code snippet.

Cheers!


2 comments:

  1. HI.. How to Hide/Show header lookup field in CRM 2011 ? PLease post the Javascript code

    ReplyDelete
    Replies
    1. Check this link it will guid you.
      https://dynamicsofdynamicscrm.com/2016/10/07/code-tip-accessing-fields-in-crm-header-and-footer-using-javascript/

      Delete