Implementing 'Next' Button Functionality on Service Portal Record Producers

Palle
Tera Contributor

Hi ServiceNow Community,

 

I'm currently working on a requirement to implement contextual search for Knowledge Base (KB) articles within record producers on the Service Portal. The objective is to dynamically display relevant KB articles based on the user's input (I have successfully implemented this part).

Once the KB articles are displayed, I aim to provide users with a "Next" button option on the record producer. This button serves as a fallback in case the displayed articles aren't helpful to the user's query. Clicking "Next" should then reveal additional variables on the record producer form, enabling users to continue with their submission (similar to the functionality of HI Support).

I have created a UI macro and a custom widget to display the 'Next' button on the form, but I'm unable to achieve the functionality of displaying additional variables when the user clicks on the "Next" button. 
Note: This is not just for one record producer, I wanna use this approach to for all other RPs.

Could anyone kindly guide me on how to accomplish this functionality within ServiceNow? Any tips, best practices, or resources you could share would be immensely helpful.

Thank you in advance for your assistance!

2 REPLIES 2

siddharth26
Tera Guru

Hi Palle,

I have going through your requirement , i just need the same as i want to create a UI button in my record producer ,

could you please let me know how to create the UI macro and Widget so that i want to create a button on my record producer for one of the use case in servicenow.

thanks

sid

Hi Siddharth, 

 

Steps to create the UI macro
1. System UI -> UI Macro

Sample code to create a button


<?xml version="1.0" encoding="utf-8"?>

<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g2:evaluate var="buttonLabel">Button Label</g2:evaluate>

<g2:evaluate var="buttonFunction">myFunction()</g2:evaluate>

<button onclick="${buttonFunction}">

${buttonLabel} </button>

<script>

function myFunction() {

 // Add your custom functionality here

}

</script>

</j:jelly>

 

2. Create a custom variable on the record producer, link the UI macro and the widget to the variable. This is necessary because UI macros alone do not function on the Service Portal.


2024-02-29_09-59-53.jpg