web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Refresh/Reload Quick View Form from JavaScript

(0) ShareShare
ReportReport
Posted on by 170

Hi all,

I've have a lookup field (Contacts) inside Phone Call form that works fine with a related Quick View Form.

The problem is that I'm changing the lookup field value via JavaScript and even if I call fireOnChange the Quick View Form never gets updated.

I'm looking for a similar functionality like the well known .refresh() for Sub-Grids.

 

Thanks!

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi,

    You could try doing this:

    Xrm.Page.ui.controls.forEach(function (c) {
    if (c.getControlType() === 'subgrid') {
    c.refresh();
    }
    });

  • TomSmelser Profile Picture
    1,570 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    This may help someone else.  

    I tried this and it worked to trigger the update of the view. If fires 2 times. But a work around for refresh not applicable.

    currentvalue = lookupcontrol.getValue();

    lookupcontrol.setValue(null);

    lookupcontrol.setValue(currentvalue);

  • DamonMKirk Profile Picture
    5 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Munavvar Husein Shaikh's code worked for me too.  fireOnChange() fixed my problem.

  • Community Member Profile Picture
    on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi,

    I have used this code, Its working fine.

    var lookup = new Array();
    lookup[0] = new Object();
    lookup[0].id = "E11EBEB2-9632-E411-A983-D89D676512B4";
    lookup[0].name = "Deactivate";
    lookup[0].entityType = "contact";
    var contactAttribute = Xrm.Page.getAttribute("new_contact");
    if (contactAttribute != null) {
    contactAttribute.setValue(lookup);
    contactAttribute.fireOnChange()
    }

    If you find it helpful, please mark it as answered.

  • Sajan Ch Profile Picture
    60 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi All,

    I faced the same problem but i choose a workaround i.e. Using js i have updated a lookup field(temp) and saved the form. I created another field with same data type and on update of 1st field i ran a real time workflow that will update the 2 nd field with same data as in the first on which quick view is set.

    Then i was able to see the data in quick view form.

    Thanks and Regards

    Sajan

  • Suggested answer
    Sajan Ch Profile Picture
    60 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi All,

    I faced the same problem but i choose a workaround i.e. Using js i have updated a lookup field(temp) and saved the form. I created another field with same data type and on update of 1st field i ran a real time workflow that will update the 2 nd field with same data as in the first on which quick view is set.

    Then i was able to see the data in quick view form.

    Thanks and Regards

    Sajan

  • nalbi Profile Picture
    10 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi. there.

    Did u find solution ?

    I have same issue.

  • insertcoin Profile Picture
    170 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Hi Tiago,

    As the SDK says refresh() method is only applicable to SubGrid controls, nevertheless I've tested it with a Quick View and didn't work.

    I try to avoid the use of document.getElementById because it is technically a DOM manipulation so my code would become unsupported.

    So, returning to my issue, it is not yet solved.

    It's really hard for me to believe this is a platform limitation, but I guess it is, which is sad.

  • tiagolvsantos Profile Picture
    740 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    Can you give a try to this.

    Code Snippet:

    gridControl = Xrm.Page.ui.controls.get("your quick view name");

    gridControl.refresh();

    Alternatively, you could use the following.

    document.getElementById("your quick view name").control.refresh();

  • insertcoin Profile Picture
    170 on at
    RE: Refresh/Reload Quick View Form from JavaScript

    No, I don't have any sub-grids. In the PhoneCall form I have a lookup field (for Contacts) and a quick view form. The lookup is set as the primary source of the quick view.

    The problem is that when I dynamically set a value for that lookup (via JavaScript) the quick view doesn't show any data. If you save and reload the whole page (F5) then it does.

    Can I refresh the QVF without having to force the user to reload the page?!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans