Add a custom button on Catalog item,

pathumharsh
Tera Contributor

I’m trying to add a custom button on a Service Catalog Item and would like some guidance on the best approach.

I need to place a custom button on the Catalog Item form that will perform a specific action when clicked, 
Example : Add a button called "Read Me", and redirect to an URL when click the button

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@pathumharsh 

You will have to use variable of type Custom and link a widget to it

That widget HTML will have a HTML button and you can then handle the URL logic

Something like this

1) widget

HTML:

<div class="form-group">
  <button type="button"
          class="btn btn-primary"
          ng-click="c.readMe()">
    Read Me
  </button>
</div>

Client Controller:

api.controller = function() {
    /* widget controller */
    var c = this;

    // Target URL you want to redirect to
    c.readMeUrl = 'https://www.google.com';

    // Action on button click
    c.readMe = function() {
        // Redirect current window to the URL
        window.open(c.readMeUrl, '_blank'); // opens in new tab
        // or use:
        // window.location.href = c.readMeUrl;  // opens in same tab
    };
};

2) add this to variable of type custom

55.png

Output

variable of type custom widget button and open url on click.gif

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Sadique Ali Kho
Tera Expert

Hey @pathumharsh ,

 

You can use a Rich Text Variable as per steps in screenshot 

Step No.1: Create Varriable 

 

image.png

 

Step No.2 : Add Link 

image.png

 

Final Result:-

image.png

Kindly Mark Helpful

View solution in original post

6 REPLIES 6

Sadique Ali Kho
Tera Expert

Hey @pathumharsh ,

 

You can use a Rich Text Variable as per steps in screenshot 

Step No.1: Create Varriable 

 

image.png

 

Step No.2 : Add Link 

image.png

 

Final Result:-

image.png

Kindly Mark Helpful

Thank you so much @Sadique Ali Kho