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

Notifications

Announcements

No record found.

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)
  • Suggested answer
    tiagolvsantos Profile Picture
    740 on at

    Hi, you can try using the following code, i assume you have a sub-grid inside your quick view right?

    Xrm.Page.getControl('your sub-grid name').refresh();
  • insertcoin Profile Picture
    170 on at

    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?!

  • tiagolvsantos Profile Picture
    740 on at

    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

    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.

  • nalbi Profile Picture
    10 on at

    Hi. there.

    Did u find solution ?

    I have same issue.

  • Suggested answer
    Sajan Ch Profile Picture
    60 on at

    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

  • Sajan Ch Profile Picture
    60 on at

    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

  • Community Member Profile Picture
    on at

    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.

  • DamonMKirk Profile Picture
    5 on at

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

  • TomSmelser Profile Picture
    1,570 on at

    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);

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans