Can I use Salesforce TAGs in Skuid?

  • 1
  • Question
  • Updated 2 years ago
  • Answered
In the standard Salesforce layouts for Chatter you can turn on "Tags" for various objects and use them to categorize them.  Can I do that in Skuid? 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Well thanks for asking....

In standard layouts the TAG functionality is part of the Chatter component.  If TAGs are enabled for an object, there will be a section on the right of the feed header that allows the user to view and add tags to individual records.  Unfortunately - the VF Chatter inlcude that we are using does not provide this option. 

BUT...  You can just build Tags in Skuid! 

Tags are a junction object that is accessible through skuid.   This means you can put a tag list anywhere on the page,  even if you don't want to expose Chatter for the record.   I built them out for contacts in my demo org. Here is how. 

1.  Create a model on the junction object.  In this case "ContactTags"



Make sure you have both the Name and the TagDefinitionId  (which is the reference back to a master list of Tags) in your model. 

The conditions for the model need to be as follows: 
-  ItemId  should be the ID field from the Contact model. 
-  Type should be Public   (Unless you want people to choose whether tags are public or private). 

2. Then put a table anywhere on your skuid page that references this model. 


I put mine in a sidebar on the contact detail record.   I did the following things to the table. 
  • Added "Name" from contact to table. 
  • Enabled "Inline ADD"  so that new tags can be added to the contact  (What is cool is that these tags will then become available for other records to use. 
  • Turned off lots of table features:  All mass actions,  Row Edit function,  Search,  Save and Cancel (I connected the model to the save button in the page header). 
  • I show all records so no pagination appears to distract the user. 

3.  Link to Tag Summary Page. 
There is a Tag Search page that salesforce provides where you can see all the records that have been connected to the Tag in context.  Getting that page to work involves a little bit of Javascript - because we have to recreate the ID15 of the TagDefinition reference ID.   Here is what you do...

a.  Create a Row Action of type "Custom"  and connect it to a snippet called "Tag Search"

b. Create a snippet of type "In-Line (Snippet) in your Resources section. 
 


The code is as follows: 
var item    = arguments[0].item,
    list    = arguments[0].list,
    model   = arguments[0].model,
    tagRow = item.row,
    tagDefId = tagRow.TagDefinitionId,
    tagName = encodeURIComponent(tagRow.Name),
    tagId15 = tagDefId.slice(0, -3),
    link =  "/search/TagSearchResults?tIdList="
        + tagId15
        + "&tagsSearch="
        + tagName 
        + "&lsc=-10";
console.log(link);
window.open( link );

4.  Enjoy your success! 

Your Contact Detail page will have a list of tags that can be added to: 


And when you select the link next to "Jolly"  you will get the tag search page showing all recors with that Tag..






Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
I love this.  It's amazing.  

I just put this together in the sandbox but I know once I give this functionality, they're going to ask how to view all of their prospects that have certain tags associated.  I know you can't use filtering in reports on Tags.  How would I add a table filter to a Contacts table based on the Tags they've applied?

This would be a subset of a Contact table that we already have for their call lists so I don't want to have them go into the search from the snippet and then try to dig through and decipher who is on their call list and who isn't.

Is that possible?

Thanks
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
I tried to do this with a Contact table condition that was set up as follows:

ContactID in the set of values on a subquery against the ContactTag object.  I've tried a few different variations of inactive and active versions of this and eventually run across this error:
  • Error:Entity 'ContactTag' is not supported for semi join inner selects
Any ideas?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
As you found, you cannot use the ContactTag object in a subquery.  This measn you can't filter your contact list based on a tag. 
What you can do however is provide a mechanism where a particular tag value is passed to a "ContactTag" list - so it will show a list of Contacts that have that tag.  You can traverse up to the contact object to show as much data as you need about the contact from there. 

If you wanted to start with what I did above, you could replace the snippet with a redirect to a skuid page.  Add a URL parameter that carries the name of the tag selected.  The destination page would use that URL parameter to filter the ContactTag list down to contacts that had the tag  (and in your case were also in the user's call log). 

You could create a similar arrangement from a list of all tags, where clicking on the row action for the tag took you to a list of all contacts that had that tag... 

Neither is as optimal as having the filter capability right on the contact table.  But it may be workable.    
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Looking into this as well. Still not able to do this using subquery on Tag junction objects. Also, can't be done on the following as per this article
  • ActivityHistory
  • Attachments
  • Event
  • EventAttendee
  • Note
  • OpenActivity
  • Tags (AccountTag, ContactTag, and all other tag objects)
  • Task
Was hoping to use this for a client and setup a Tag filter on the table. :(
(Edited)