Service Portal: How to display message after submit a Record Producer?

yltsai
Mega Guru

I have googled for the past couple days and read a lot of posts but I am lost.

Followings are some facts for reference:

1. We are using Jakarta family

2. I used OOB SC Catalog Item widget to show my incident record producer

3. I succeeded to redirect users to a desired Service Portal page

But, I am not able to show messages on the top of desired page to say, "Your <incident number> was submitted." to make users feel comfortable. 

I tried do it in Record Producer script but it did not re-direct the user to the desired Service Portal page. So, I used the OOB widget instance options to give the destination page.

Please help! Thank you,

1 ACCEPTED SOLUTION

ChrisBurks
Mega Sage

Hello,

 

1) Yes, bring in spUtil in a custom widget.

function(spUtil) {

     spUtil.addInfoMessage(<add your message in here.... combination of string and variable values if needed>)

}

Server script will be used to grab things from the url if needed.

For example if you need the sys_id that's passed:

var sysid = $sp.getParameter('sys_id');

// do something with the sysid

2) The widget doesn't have to be placed at the top of the page. It will automatically display the info message at the top.

3) You don't need to clone the OOB widget. Use the widget instance options on the widget to redirect to the desired page:

    find_real_file.png

 

find_real_file.png

 

Looking at the options you can use a custom url or set the page and what table to use when using the auto redirect on Successful Order option

 

View solution in original post

8 REPLIES 8

ChrisBurks
Mega Sage

There are a few ways to do this but one fairly quick and easy way to do it is to add a custom widget on the destination page (the page redirecting to) that uses spUtil.addInfoMessage() method. When using the OOB SC Catalog Item widget to redirect,  normally it will put parameters in the url such as table and/or sys_id of the record created after submission. Then you could use that information in your custom widget to get something like the incident number that was created and pass that to the addInfoMessage method.

You can find more information on how to use spUtil.addinfoMessage here: https://serviceportal.io/docs/documentation/widget_client_script_apis.md

And information on how to get details from params in the url: https://serviceportal.io/docs/documentation/widget_server_script_apis.md#getParameter

yltsai
Mega Guru

Hi Chris,

Let me try to put them all together.

1. Create a custom widget to use spUtil.addInfoMessage() in the client script. How about server script?

2. Add the above custom widget on the top of my desired page. Will the message go away after few second?

3. Clone the OOB widget to add a redirection code.

Am I on the right direction?

Thank you,

ChrisBurks
Mega Sage

Hello,

 

1) Yes, bring in spUtil in a custom widget.

function(spUtil) {

     spUtil.addInfoMessage(<add your message in here.... combination of string and variable values if needed>)

}

Server script will be used to grab things from the url if needed.

For example if you need the sys_id that's passed:

var sysid = $sp.getParameter('sys_id');

// do something with the sysid

2) The widget doesn't have to be placed at the top of the page. It will automatically display the info message at the top.

3) You don't need to clone the OOB widget. Use the widget instance options on the widget to redirect to the desired page:

    find_real_file.png

 

find_real_file.png

 

Looking at the options you can use a custom url or set the page and what table to use when using the auto redirect on Successful Order option

 

Hi Chris,

I implemented a custom widget and put a line of code in the Client Control:

function() {
      /* widget controller */
      //var c = this;
     spUtil.addInfoMessage("Thank you. Your" + g_form.getValue('number') + " was created.");
}

I did not put anything in the Server script.

The widget instance option redirects to the page I want. But I still could not get the message on top of my desired page.

What did I miss here? I am still struggling through right now.