How can I add a Cancel button on Service Portal ?

gmorales
Kilo Expert

Hello Guys,

I got a requirement to add a cancel button to cancel the actual order and redirec to home page... However I thought they were using CMS, I've noticed that there is a Plug in called "Service Portal" and it builds a complete site... this is completely new for me I've started to play with this but is completely different I've tried this (https://serviceportal.io/create-custom-action-buttons-service-portal/) but there is no instructions on how to add it to a specific page or form. Need Help ASAP, I couldn't find a documentation or clear examples of this.

Thanks!

1 ACCEPTED SOLUTION

Go here;



find_real_file.png



Then go here;



find_real_file.png



Click the "Edit Ticket Form (ticket) page in Designer



Then Drag&Drop your new widget into the page where you want it!


View solution in original post

14 REPLIES 14

AWESOME!!!!



Thank you so much!


Hi,

 

Incident Widget is working for me in Kingston. But for requested Item i get the following error message in log:

org.mozilla.javascript.EvaluatorException: GlideRecord.get() - invalid table name: null (<refname>; line 32)
Line(32)
return table;
evaluateString(JavaScript evaluation error on:
(function(){(function() {
data.sys_id = input.sys_id || options.record_id || $sp.getParameter("sys_id");
data.table = input.table || options.record_table || $sp.getParameter("table");
data.table = _getActualTable(data.table, data.sys_id);
data.maxAttachmentSize = parseInt(gs.getProperty("com.glide.attachment.max_size", 1024));
if (isNaN(data.maxAttachmentSize))
data.maxAttachmentSize = 24;
data.largeAttachmentMsg = gs.getMessage("Attached files must be smaller than {0} - please try again", "" + data.maxAttachmentSize + "MB");
data.attachmentSuccessMsg = gs.getMessage("Attachment successfully uploaded");

if (!data.table || !data.sys_id)
return;

var gr = new GlideRecord(data.table);
if (!gr.isValid())
return;

if (!gr.get(data.sys_id))
return;

if (input && input.action == "deleted") {
gr.comments = input.action + " an attachment";
gr.update();
}

data.canWrite = gr.canWrite();
data.canAttach = gs.hasRole(gs.getProperty("glide.attachment.role")) && GlideTableDescriptor.get(data.table).getED().getAttribute("no_attachment") != "true";
data.canRead = gr.canRead();

function _getActualTable(table, id) {
var rec = new GlideRecord(table);
if (rec.get(id) && rec.getValue('sys_class_name')) {
return rec.getValue('sys_class_name');
}
return table;
}
})();
})()
)

 

hi all,



Attached is a document with screen shots from action buttons I added to the Incident and Request/Requested Items widgets. The other file is an update set.


These were consolidated and reworked with code and information I found in this post and some others.



kind regards, Bruno


Bruno De Graeve,
Principal Platform Architect, Customer Success, ServiceNow

These widgets aren't working in Kingston. I added the widgets to the Request form via Designer, but still nada. Is there something that needs to be changed in your script to work properly??

 

Thanks.

hi Brandon,

What exactly is not working ? Do you receive an error message ? The request status page in London has been changed. That's why you probably do not see these buttons anymore. We'll have to amend that page again. 

Bruno

Bruno De Graeve,
Principal Platform Architect, Customer Success, ServiceNow