9 thoughts on “How to apply script on Header fields and BPF fields

  1. bipinshan@gmail.com


    On Interactive Service Hub Case form we are getting null reference of Status Reason field which is present on Header. we have used javascript code to access
    var statusReason_header = Xrm.Page.getControl(“header_statuscode”);.

    This code is working fine in Web client but interactive service hub is returning null reference.


    1. inogic


      In case of Interactive service hub Case form, though the “Status Reason” field is in the Header it can be retrieved using just Xrm.Page.getControl(“statuscode”).

      There is no need to append “header_” to the field to the field name.


  2. aaeeo

    I have a lookup that occurs in two places on a business process flow, but the filter that I’ve applied to it isn’t only affecting the first instance. Do you know how I might apply it to both?

    1. aaeeo

      I meant IS only affecting the first instance, i.e. the second occurrence of the field is unfiltered.

      1. inogic

        If you have two instance of field on BPF then and you want to perform any operation on second instance then use 1 after field logical name.
        For example if you have two instance of Parent contact field on BPF then
        for first instance use following code : Xrm.Page.getControl(“header_process_parentcontactid”).setVisible(false);
        for second instance use following code : Xrm.Page.getControl(“header_process_parentcontactid1”).setVisible(false);
        Please let us know if it works for you.


        1. aaeeo

          Thanks, it did work, I wrote an additional function to iterate through the fields adding a number each pass until there were no more left. Works great!

          1. Mayur Hande

            Hi I tried this code

            but it shows me field not present.

  3. meba


    I am trying to implement this, I have a many to many relationship between the two entities. I am wondering how the fetch looks like? I tried modifying yours but no luck. Also is statecode needed in the fetch?


    1. Inogic

      Hi ,

      Regarding statecode, to get only active records we use “statecode” in fetch query. If you want records to be filter based on the Status of record then use “statecode” in the query. For example, show only active account, show only open opportunities etc.

      Regarding FetchQuery for two entities,

      Are you trying to filter the lookup having filter on the N:N relationship?

      Could you please elaborate your query so it will help us to understand the exact requirement.



Comments are closed.