<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get name of visual a user clicked on with JS in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Get-name-of-visual-a-user-clicked-on-with-JS/m-p/3568875#M45655</link>
    <description>&lt;P&gt;In case anyone looks at this in the future, you can get the visual name throught the event parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is a visualClicked event you can subscribe to which then provides the visual details including the name.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#events-and-their-response-values" target="_blank"&gt;https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#events-and-their-response-values&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2023 16:23:34 GMT</pubDate>
    <dc:creator>JAnder</dc:creator>
    <dc:date>2023-12-05T16:23:34Z</dc:date>
    <item>
      <title>Get name of visual a user clicked on with JS</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-name-of-visual-a-user-clicked-on-with-JS/m-p/3561227#M45567</link>
      <description>&lt;P&gt;Is there a way to retrieve the name of a visual on a report from a user click. I know i can call `report.getPages()` and then on a page do `page.getVisuals()` but ideally i would like to just pick up the visual name from a click, maybe a custom context menu option that could then pass it as a parameter to a function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To clarify the Playground shows the below code, but it does not show you how to get the &lt;SPAN&gt;VisualContainer4&lt;/SPAN&gt; value. That code assumes you know the visual name....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;try {
    const pages = await report.getPages();

    // Retrieve the active page.
    let page = pages.filter(function (page) {
        return page.isActive
    })[0];

    const visuals = await page.getVisuals();

    // Retrieve the target visual.
    let visual = visuals.filter(function (visual) {
        return visual.name === "VisualContainer4";
    })[0];

    const filters = await visual.getFilters();
    console.log(filters);
}
catch (errors) {
    console.log(errors);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Nov 2023 14:51:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-name-of-visual-a-user-clicked-on-with-JS/m-p/3561227#M45567</guid>
      <dc:creator>JAnder</dc:creator>
      <dc:date>2023-11-30T14:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get name of visual a user clicked on with JS</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Get-name-of-visual-a-user-clicked-on-with-JS/m-p/3568875#M45655</link>
      <description>&lt;P&gt;In case anyone looks at this in the future, you can get the visual name throught the event parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is a visualClicked event you can subscribe to which then provides the visual details including the name.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#events-and-their-response-values" target="_blank"&gt;https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#events-and-their-response-values&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:23:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Get-name-of-visual-a-user-clicked-on-with-JS/m-p/3568875#M45655</guid>
      <dc:creator>JAnder</dc:creator>
      <dc:date>2023-12-05T16:23:34Z</dc:date>
    </item>
  </channel>
</rss>

