Widget to add an image and link in SP

VJ4
Giga Expert

Hi guys,

I want to create a widget where you can browse for an image and it will be added onto the panel and also an option to add a link wrapping the image. I fiddle around with widget options schema but couldn't get it working and wondered if this was the way to go about it?

Many thanks!

3 REPLIES 3

Sanjeev Kumar1
Kilo Sage

Hi,


look it.



ServicePortal Archives - ServicePortal.io



it will help you


dgriffoi
Kilo Explorer

Did you find it?



It will help to me if you know.



Thanks.


Diego


Hi Diego,



Not sure if the approach I took was the most elegant, but since you asked here's what I did to achieve the results I was after.



1. Create a new widget or clone the existing icon link widget.


2. Add two new options schemas, one for the image URL and the other for the link. In my case both of them were strings.


3. Bind the data to the HTML


<div>


  <h3>{{::options.title}}</h3>


  <a href="{{::options.imglink}}" target="_blank">


  <img src="{{::options.testimg}}" alt="" />


  </a>


</div>



find_real_file.png




find_real_file.png



As you can see, since the link to the image is a string you will have to upload the image to servicenow first and then copy the filename with extension and paste into the imagelink instance option. This work as expected for me. Let me know if you have any questions.