If your in lightning experience on click of any actionable item you want to take the user to the Global Search and perform the search action using the dynamic search string.To get the url of the global search in lightning using java script please refer the below code.
The format of url must be
var searchStr = 'Sree'; //Search String var stringToEncode = '{"componentDef":"forceSearch:search","attributes":{"term":"'+searchStr+ '","scopeMap":{"type":"TOP_RESULTS"},"context":{"disableSpellCorrection":false,"SEARCH_ACTIVITY":{"term":"'+ searchStr + '"}}}}'; var encodedStr = btoa(stringToEncode); //Base64 encoding var redirectUrl='/one/one.app?source=aloha#'+encodedStr;
The format of url must be
String redUrl = '/one/one.app?source=aloha#'+base64EncodedSearchString;
If you want to the same thing using apex please refer this post
No comments:
Post a Comment