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 365 | Integration, Dataverse...
Answered

How can i fetch current view name after clicking on Ribbon Button in Dynamics 365

(0) ShareShare
ReportReport
Posted on by 110

Hi ,

I want to fetch view name on clicking of ribbon button . for eg . below i have opened Contacts in Dynamics 365 . By default it opens default view i.e "My Active Contacts" .

pastedimage1579663791869v2.png

So when i click on New button in this view then i want to run some custom javascript where i want to fetch this view name "My Active Contacts". As based on view name , i want to open different form as per each view.

So i tried by follow below mentioned blog but this javascript throws error when running .

Error :- object doesn't support property or method 'get_viewtitle'

Blog :- https://mahadeomatre.blogspot.com/2015/04/hide-ribbon-button-based-on-view.html

Can anybody help me on this . How can i do it ?

Thanks

I have the same question (0)
  • Suggested answer
    Gilmeyer Profile Picture
    on at

    Hi,

    There is no supported way to achieve that.

    However, in the comments section of the referred article they explain which method should be used for D365.

  • Dynamics 365 Sumit Thakran Profile Picture
    110 on at

    Hi Gimeyer,

    i even tried code given in comments section of article but its not working.

    Below is comment section code :-

    selectedCtrl.getCurrentView(): Xrm.LookupObject

    entityType: "savedquery"

    id: "{00000000-0000-0000-00AA-000010001001}"

    name: "999.exampleView"

    __proto__: Object

    Nothing happens when i add this code . Can you help whats wrong in code

    Thanks

  • Gilmeyer Profile Picture
    on at

    Hi,

    There is not a supported way to achieve that.

    Thanks

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hello Sumit Thakran,

    The method proposed on the blog does not work on UCI. I found an alternative that works on UCI but is not supported. The Basic Idea is to find the viewId.

    in your JS, use this: Xrm._page.getUrl(), the result would be something like:

    use this sample code to get the viewId:

    var urlParams = new URLSearchParams(Xrm._page.getUrl());
    var viewId = urlParams.get("viewid").replace("{","").replace("}","")
    
    console.log("viewId: "   viewId)
    /*
    viewId: 61273827-328E-E011-95AE-00155D9CFA03
    */

    hope this helps,

    Mehdi

  • Dynamics 365 Sumit Thakran Profile Picture
    110 on at

    Thanks , my issue sorted out.

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 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 51

#2
Martin Dráb Profile Picture

Martin Dráb 39 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 26 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans