How can I add a search bar within my SP widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 10:30 AM - edited 12-15-2023 10:30 AM
I have a service portal widget that is a sidebar for my custom Service Portal and I want to add a typeahead search into it. Currently, I have code like this:
HTML:
<div>
<div>
<sp-widget widget="data.example"></sp-widget>
</div>
</div>
SERVER:
data.example = $sp.getWidget('typeahead_search', {});
This doesn't work
"$sp is not defined".
Is there any way to do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 10:31 AM
Hi @Bushra Syed
Please provide screen shot where you want to add?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 10:35 AM
It is within a custom widget I made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:00 PM
Hi @Bushra Syed ,
If you're using a portal widget your code should be good the way it is except for the widget id for the typeahead search. The id for that widget has a hyphen and not an underscore.
Using the widget editor with preview on, the screenshoot below shows the code working.