0
votes

I've been trying to execute a piece of code to filter the Lookup on the Business Process Flow and I'm trying to access the field but the Xrm.Page.getControl("header_process_new_referenceid") is returning null all the times, even though i'm on the correct stage when the form is loaded.

Also looked at this previous post but with no actual answer- Cannot access header or business process flow controls on a CRM form

1
The question you linked has a correct answer, simply the author of the question did not mark that answer. I just checked on my online CRM and it works flawlessly with Chrome Tools or with any JS that runs on onload even on the form. And I even have the filtering in the lookupPawel Gradecki
A comment in the linked question says the code works in CRM form load, only seeing null in browser console. Did you try settimeout & see the control is accessible after a sec?Arun Vinoth

1 Answers

0
votes

There are a couple potential issues that you may be facing.

My first suggestion is to check that you have the control name correct. The easiest way to check is to install the Chrome Level Up plugin. Once it's installed, navigate to your form, and select the Logical Names button to display the logical names.

Once you've determined that you have the correct logical name, the second thing to check is how you are actually accessing the Xrm object? Are you executing from within the form on load, or a ribbon button, or a Web Resource. Depending on the version of CRM, there are different ways to access the Xrm object. Ensure that you are in the correct frame when attempting to access the Xrm object.