Context in search results?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I'm using the Search component for global search in a top nav bar. It searches the account object, but rather than the select action navigating to an account detail page, I want to run a snippet that passes the account id to a condition on a model. I have the snippet ready, but how do I access the context of the returned search result row?

Here's my snippet that was originally designed to work with a table row action:

var params = arguments[0], item = params.item, row = item.row;
$ = skuid.$;
//Updates the URL to "navigate" to "ClientView" for the selected client.
history.pushState(null, null, 'ZZZZ_PractiFI?p=clv&id=' + row.Id);
//Empties the "OrgView" models, which also hides the content of that include.
var orgModel = skuid.model.getModel('OV_Org');
orgModel.emptyData();
//Filters the client model for the selected client, which refreshes "ClientView-Basics".
var clbModel = skuid.model.getModel('CV_Client');
clbCondition = clbModel.getConditionByName('Id');
clbModel.setCondition(clbCondition, row.Id);
clbModel.updateData();
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Glen,

My guess is that arguments[0].model and .row will get you what you want, but you could just console.log(arguments); at the beginning of your snippet to see what is getting passed to the snippet from the search component.