Form Button not showing up in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 07:30 AM
Good morning everyone,
I have a print button that I created on form in ServiceNow. The button works fine within the platform but when I view the form within the Service Portal, the button is missing. Its an client-side button, which I'm sure is part of my problem. I've tried using the gsftSubmit(null, g_form.getFormElement(),'print') but haven't had any luck. Could someone check out my code and tell me what I'm doing wrong? Here's my code along with a screenshot of the ui action:
gsftSubmit(null, g_form.getFormElement(),'print');
if (typeof window == 'undefined')
popOutLink();
function popOutLink() {
var user = g_form.getReference('u_name');
var signature= new GlideRecord('u_signature');
signature.addQuery('u_document_id', user.sys_id);
signature.orderByDesc('sys_created_on');
signature.query();
if(signature.next())
{
}
window.open('wow_document.do?sysparm_signature=' + signature.sys_id+"&sysparm_wow_doc="+g_form.getUniqueValue()+"&sysparm_name="+user.name);
}
Any help will be greatly appreciated!
Best regards,
cnharris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 08:39 AM
Hi Harris,
Then any error you see in browser console while form loads in portal?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 08:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 10:02 AM
Hi Harris,
That is because on Service Portal side GlideRecord is not allowed in client side code; you can use getReference() with callback and also use script include with GlideAjax and try once
OR else directly do GlideAjax and send value of u_name to script include function and rest do in script include function
update it as below:
function popOutLink() {
var user = g_form.getReference('u_name', callBackMethod);
}
function callBackMethod(user){
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2019 12:55 PM
Hi Ankur,
I update my code but still can't get the button to display on the form in the Service Portal, however, you did point me in the right direction.
Best regards,
cnharri