You need to sign in to do that
Don't have an account?
Austin Villanueva
How to pass string to lightning search?
Hi everyone, How can I pass string to lightning search?
Is there a way similar to classic where we can pass a string instead of typing the search keyword?
If there is any solution let me know. Our clients wants to do it in lightning instead of classic.
Thank you.
Austin
Is there a way similar to classic where we can pass a string instead of typing the search keyword?
If there is any solution let me know. Our clients wants to do it in lightning instead of classic.
Thank you.
Austin
As per my knowledge there is no such way to do in lightning. Because lightning is SPA which calls server only when needed and loads specific component in a seperate iframe.
In this case the search area is laoded internally without loading the whole page. And lightning framework also takes care of other security aspects.
So if you have noticed when you search in lightning, the url changes to something like this -
https://mustafaj-dev-ed.lightning.force.com/one/one.app#eyJjb21wb25lbnREZWYiOiJmb3JjZVNlYXJjaDpzZWFyY2giLCJhdHRyaWJ1dGVzIjp7InZhbHVlcyI6eyJ0ZXJtIjoiTXVzdGFmYSIsInNjb3BlTWFwIjp7Im5hbWVzcGFjZSI6IlNldHVwIiwidHlwZSI6IlRPUF9SRVNVTFRTIiwibGFiZWxQbHVyYWwiOiJTZXR1cCJ9LCJjb250ZXh0Ijp7ImluZm8iOnt9LCJkaXNhYmxlU3BlbGxDb3JyZWN0aW9uIjpmYWxzZSwiU0VBUkNIX0FDVElWSVRZIjp7InNlYXJjaElkIjoiYmI4NGM5M2QtNjA1Ny1mNzI0LTgxOGUtY2FiMTE4OTY2ZDFjIiwic3RhcnRUaW1lIjoxNDk3Mjk0NjQxMDI0LCJ0ZXJtIjoiTXVzdGFmYSJ9fX19LCJhOnQiOjE0OTcyOTQ2NDEwMjl9
Basically it encrypts the data here to avoid the malicious activities.
So to answer your question, this won't be done in lightning. You can inform your client by saying that if we do so there is a huge security risk where some user can inject malicious code through URL and which can cause some major issues, so better to not to go with that.
Hope you find this helpful.
Note - Kindly mark this answer as best answer if this helped you, so that other's can also get benefit from it.
Thanks,
Mustafa Jhabuawala
Techincal Lead at Zen4orce (http://www.zen4orce.com)
All Answers
Can you please clarify this once -
You are talking about passing the search keyword from URL. For ex - https://yourdomain.my.salesforce.com/search/SearchResults?searchType=1&sen=0&setLast=1&sbstr=YOUR_SEARCH_KEYWORD&search=Search
Similarly you this need in Lightning ? Is it ?
Thank you for your response. yeah, when I do search in classic, I get url like this
https://na50.salesforce.com/_ui/search/ui/UnifiedSearchResults?searchType=2&sen=001&sen=003&sen=00T&sen=00U&sen=005&sen=02i&sen=701&sen=800&str={SEARCH_KEYWORD}
I want similar thing in Lightning. Is there a way to do that? I hope there is. Please help me. Thank you.
As per my knowledge there is no such way to do in lightning. Because lightning is SPA which calls server only when needed and loads specific component in a seperate iframe.
In this case the search area is laoded internally without loading the whole page. And lightning framework also takes care of other security aspects.
So if you have noticed when you search in lightning, the url changes to something like this -
https://mustafaj-dev-ed.lightning.force.com/one/one.app#eyJjb21wb25lbnREZWYiOiJmb3JjZVNlYXJjaDpzZWFyY2giLCJhdHRyaWJ1dGVzIjp7InZhbHVlcyI6eyJ0ZXJtIjoiTXVzdGFmYSIsInNjb3BlTWFwIjp7Im5hbWVzcGFjZSI6IlNldHVwIiwidHlwZSI6IlRPUF9SRVNVTFRTIiwibGFiZWxQbHVyYWwiOiJTZXR1cCJ9LCJjb250ZXh0Ijp7ImluZm8iOnt9LCJkaXNhYmxlU3BlbGxDb3JyZWN0aW9uIjpmYWxzZSwiU0VBUkNIX0FDVElWSVRZIjp7InNlYXJjaElkIjoiYmI4NGM5M2QtNjA1Ny1mNzI0LTgxOGUtY2FiMTE4OTY2ZDFjIiwic3RhcnRUaW1lIjoxNDk3Mjk0NjQxMDI0LCJ0ZXJtIjoiTXVzdGFmYSJ9fX19LCJhOnQiOjE0OTcyOTQ2NDEwMjl9
Basically it encrypts the data here to avoid the malicious activities.
So to answer your question, this won't be done in lightning. You can inform your client by saying that if we do so there is a huge security risk where some user can inject malicious code through URL and which can cause some major issues, so better to not to go with that.
Hope you find this helpful.
Note - Kindly mark this answer as best answer if this helped you, so that other's can also get benefit from it.
Thanks,
Mustafa Jhabuawala
Techincal Lead at Zen4orce (http://www.zen4orce.com)
Yeah you are right I noticed that. Compared to Classic, Lightning doesn't refresh the page all the time but is there any alternative to do the same thing? Do you know any alternative ? Thank you.
But what you can do is, if your client needs search for some specific objects like accounts, contact, opportunity or any other objects then you can create a custom search component which does the same thing and also you can pass attributes to the components in this case to get the search result instead of typing any search keyword. But there will be an additional effort to achieve this.
Hope you find this infromation helpful.
Thanks,
Mustafa Jhabuawala
Techincal Lead at Zen4orce (http://www.zen4orce.com)
Thanks again.
-Austin
Thanks,
Mustafa Jhabuawala
Technical Lead at Zen4orce (http://www.zen4orce.com)
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000UZkyQAG
For example, the following string:
eyJjb21wb25lbnREZWYiOiJmb3JjZVNlYXJjaDpzZWFyY2giLCJhdHRyaWJ1dGVzIjp7InZhbHVlcyI6eyJ0ZXJtIjoiTXVzdGFmYSIsInNjb3BlTWFwIjp7Im5hbWVzcGFjZSI6IlNldHVwIiwidHlwZSI6IlRPUF9SRVNVTFRTIiwibGFiZWxQbHVyYWwiOiJTZXR1cCJ9LCJjb250ZXh0Ijp7ImluZm8iOnt9LCJkaXNhYmxlU3BlbGxDb3JyZWN0aW9uIjpmYWxzZSwiU0VBUkNIX0FDVElWSVRZIjp7InNlYXJjaElkIjoiYmI4NGM5M2QtNjA1Ny1mNzI0LTgxOGUtY2FiMTE4OTY2ZDFjIiwic3RhcnRUaW1lIjoxNDk3Mjk0NjQxMDI0LCJ0ZXJtIjoiTXVzdGFmYSJ9fX19LCJhOnQiOjE0OTcyOTQ2NDEwMjl9
can be easily converted to the following:
{"componentDef":"forceSearch:search","attributes":{"values":{"term":"Mustafa","scopeMap":{"namespace":"Setup","type":"TOP_RESULTS","labelPlural":"Setup"},"context":{"info":{},"disableSpellCorrection":false,"SEARCH_ACTIVITY":{"searchId":"bb84c93d-6057-f724-818e-cab118966d1c","startTime":1497294641024,"term":"Mustafa"}}}},"a:t":1497294641029}
By a simple base64 decode here - https://www.base64decode.org/
This is not encryption and it adds no zecurity. It is more likely just a way to make sure that none of the payload is lost due to special characters in the URL.
Great answer Brian. THAT's what I needed. The explanation seems obvious too.
I'm trying to build links from Jira back to Salesforce, incorporating a search requirement into that logic doesn't make sense now that you said this. I need to use the ID specifically and THAT can be referenced in a lightning URL. The users that want to automate the link back to salesforce cases by case number, we don't have an API or ID in Jira. Just case numbers. -- They will use native search in Salesforce as part of their process until we get an API built.