Embedded Cards in Salesforce: Dynamic Filter

jstan
jstan Dallas, TX 🟠

Hi all, does anyway know if there is a way to dynamically filter a Domo card embedded in salesforce on a unique value in the salesforce page (like customer or account ID).  We wanted to embed cards on a customer overview page to show historical sales for that customer, but I do not want to have to create one for every customer (15k +).  I doubt this is possible today, but I know I can use embedded links in Domo data tables to link directly to a salesforce page, I just wonder if anyone figured out a way to have that page id filter the Domo card embedded in Salesforce.  

 

Thanks,

Josh

 

Tagged:

Best Answers

  • CJ
    CJ ⚪️
    Answer ✓
    Hey Josh, I had the same issue. I was reading this post and almost thought I wrote it. Lol.

    Fortunately there is something you can do to start with. It’s not ideal as the ideal state would be all the way down to the card level filter parameters with the embed feature, but it works for us and I think it will work for you as well. So here we go.....

    Domo pages can be passed filters via a query string. So you can embed pages via a visualforce page and pass account or any other id’s to the page. It will then filter the entire page on the field or fields you want.

    Here is the pfilters structure you can append to any domo page or card url to pass filtering:
    pfilters=[{"dataSetId":<ID>, "column": "<Column Name>", "dataType": "<string |number | date>" , "operand":"IN", "values":<Array of values>}]

    One other neat feature is if you have cards that are using different data sets, blends or etl’s and want to filter them all on a common field then just leave the data set blank. As long as all of your data sets share the same field name they will all filter on the value you passed even though the are not the same data set.

    I have not been able to find a solution for single cards yet but my suggestion to Domo is to add this querystring capability to the embed card functionality and now we have max flexibility and don’t need to load the whole Domo interface in the SalesForce view.

    Hope this helps.

    CJ
  • Canioagain
    Canioagain 🟡
    Answer ✓

    I got it to work!!!!

    <apex:page standardController="Account">

    <iframe src="https://my.domo.com/embed/card/11111186?enable=title&amp;pfilters=[{"column":"AccountId","dataType":"STRING","operand":"IN",
    %22values%22:[%22{!Account.Id}%22]}]
    " width="600" height="550" marginheight="0" marginwidth="0" frameborder="0" scrolling="yes"></iframe></apex:page>

     

Answers

  • I am trying to follow the steps by attaching the pfilters query string to the DOMO Card URL in apex iframe. But I am not successful in acheiving it. Can you let me know how you acheived to filter the DOMO card via Saleforce.It would be helpful if you also provide the steps or a syntax to acheive this.


  • @CJwrote:
    Hey Josh, I had the same issue. I was reading this post and almost thought I wrote it. Lol.

    Fortunately there is something you can do to start with. It’s not ideal as the ideal state would be all the way down to the card level filter parameters with the embed feature, but it works for us and I think it will work for you as well. So here we go.....

    Domo pages can be passed filters via a query string. So you can embed pages via a visualforce page and pass account or any other id’s to the page. It will then filter the entire page on the field or fields you want.

    Here is the pfilters structure you can append to any domo page or card url to pass filtering:
    pfilters=[{"dataSetId":<ID>, "column": "<Column Name>", "dataType": "<string |number | date>" , "operand":"IN", "values":<Array of values>}]

    One other neat feature is if you have cards that are using different data sets, blends or etl’s and want to filter them all on a common field then just leave the data set blank. As long as all of your data sets share the same field name they will all filter on the value you passed even though the are not the same data set.

    I have not been able to find a solution for single cards yet but my suggestion to Domo is to add this querystring capability to the embed card functionality and now we have max flexibility and don’t need to load the whole Domo interface in the SalesForce view.

    Hope this helps.

    CJ


    Hi @CJ, I was able  to achieve the page filters as per your suggestion and also per the information available in Best Mode. But my requirement is When I login into Salesforce as an admin I need to view all the details in the embeded cards(My Cards is simple line Graph between Agents and No Of Consumers) and if I login as an Agent I need to view only that Agents data.

    Any suggestions on the above filtering method would be helpful.

     

  • CJ
    CJ ⚪️

    Do you have a field in the data set that Id's the individual agent?  If you do then just pass that from Salesforce as a filter value on that column when not logged in as an admin.  When you are an admin then don't pass the filter value and you should get all the data to power those cards.

  • @CJwrote:

    Do you have a field in the data set that Id's the individual agent?  If you do then just pass that from Salesforce as a filter value on that column when not logged in as an admin.  When you are an admin then don't pass the filter value and you should get all the data to power those cards.


    @CJ : Yes I do have the field in the Dataset that holds the ID's of the individual agent. As I am new to this tool as in DOMO and SalesForce. Can you please let me know the ellaborated steps to pass the id as a filter value when admin and when as an agent. It would be helpful for me as well other users. Thanks in advance for your support.

  • This is great,we can use it to filter individual embedded cards within our visualforce page. Thank you so much for posting!!

  • Hi CJ,

    By any chance did you have SSO enabled for DOMO?  We have SSO enabled but since this is embedded in Salesforce it is not allowing for the authentication without first signing into DOMO.

    Any help would be great.

    Thanks Dwayne

  • Is there any way you can share with me the url you used in the salesforce Iframe? (remove any sensitive data and replace with generic terms) 

     

    I can't figure out how to pass the data in the URL....

     

    this is all I'm able to get working:

     

    <apex:page standardController="Account">

    <iframe src="https://mycompany.domo.com/embed/card/720220402?" width="350" height="250" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe></apex:page>
  • To embed a card with filters passed via url (remove the angle brackets and replace with your own variables):

     

    <iframe src="https://mycompany.domo.com/embed/card/720220402?enable=title,summary&pfilters=[{%22column%22:%22<COLUMN TO FILTER>%22,%22dataType%22:%22<STRING, NUMBER, DATE, ETC>%22,%22operand%22:%22<IN, NOT IN, =, ETC>%22,%22values%22:[%22<VALUE TO FILTER AS>%22]}]" width="350" height="250" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe>

     

    The important part is bolded and underlined.

     

    This will also work for pages, just replace the URL in src=with the entire page URL

  • Thank you for this, I'm a neophyte when it comes to HTML.  

    I'm trying to pass the Account.ID field from a salesforce page into the value to filter.  How would that look in the code you attached?    I half a33ed this and got a pfilter error on my visual force page.  I don't know what string to put in the code.  When my guys are in Salesforce and they are on Acme's Account page in I want to pass that Account.ID from Salesforce into this string. Somehow....

     

    https://mycompany.domo.com/embed/card/12345679?enable=title,summary,&pfilters=
    [{%22column%22:%22<Account.Id>>%22,%22dataType%22:%22<STRING>%22,%22operand%22:%22<IN=>%22,%22values%22:[%22<VALUE TO FILTER AS>%22]}]
  • 1) You have an extra comma before "&pfilters" 

    2) Angle brackets must be removed

    3) Replace <VALUE TO FILTER AS> with the account ID string you want to look for

     

    https://mycompany.domo.com/embed/card/12345679?enable=title,summary&pfilters=
    [{%22column%22:%22Account.Id%22,%22dataType%22:%22STRING%22,%22operand%22:%22IN%22,%22values%22:[%22VALUE TO FILTER AS%22]}]

     

  • thank you, but that is what I don't understand.  The account ID is going to change depending on what account they are viewing in Salesforce

  • I know I'm dense, but my HTML skills are almost as good as my latin (nill)

    I'm getting a pfilter error with this

    <apex:page standardController="Account">

    <iframe src="https://mycompany.domo.com/embed/card/12636?enable=title,summary&pfilters=
    [{%22column%22:%22Account.Id%22,%22dataType%22:%22STRING%22,%22operand%22:%22IN%22,%22values%22:[%Account.Id AS%22]}]
    " width="350" height="250" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe></apex:page>

     

  • Ok, I've got to be close b/c now my only "error" is the card in Domo when posted in Salesforce says: No Data Filtered in Range.  image.png

    <iframe src="https://mycompany.domo.com/embed/card/8876?enable=title&amp;pfilters=[{"column":"Account.Id","dataType":"STRING","operand":"IN","values":["Account.Id AS%22]}]
    " width="600" height="550" marginheight="0" marginwidth="0" frameborder="0" scrolling="yes"></iframe></apex:page>
  • I'm so darn close:

    ok, so I'm very close (I think).  I have this, but I'm getting a message that says "No Data in Filtered Range"  Which tells me I'm not passing the Account.ID over.  

     

    <iframe src="https://mycompany.domo.com/embed/card/876?enable=title&amp;pfilters=[{"column":"Account.Id","dataType":"STRING","operand":"IN","values":["Account.Id AS%22]}]
    " width="600" height="550" marginheight="0" marginwidth="0" frameborder="0" scrolling="yes"></iframe></apex:page>


    So what I thought I want to do, but don't know how is to somehow get the Account id in the URL to pass thru?

     

    https://my.lightning.force.com/lightning/r/Account/0013000xpattAAM/view


    Shouldn't I be able to pass the account id from the page I'm on into my code above?

  • Unfortunately in your case it looks like you'll have to write a javascript function to find and pass the account ID from the current page URL into the Domo iframe URL.

  • Hey @canio, with your solution, was SSO required? I've tried to replicate your solution but the Filter doesn't seem to be sticking for Account Name on my end.