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

  1. bipinshan@gmail.com

    Hi,

    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.

    Thanks.

    1. inogic

      Hi,

      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.

      Thanks!
      Sam

  2. aaeeo

    Hi,
    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?
    Thanks,
    Adam

    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.

        Thanks!

        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
            Xrm.Page.getControl(“header_process_willis_probability1”).setDisabled(true);

            but it shows me field not present.

  3. meba

    Hi,

    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?

    Thanks

    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.

      Thanks!

      Sam

Comments are closed.