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

remember to bring in spUtil in the parameter of the controller function:

 

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

 

also g_form by itself isn't going to work here. g_form would only work if:

1) the widget you're using is used as a variable on the catalog item itself meaning that you used the Macro type and then set the widget field on the default tab of the variable with your custom widget. It's not really needed in this case. That's why you would use the Server script to grab the information in the url to get to your created record number. Or you could use $location in the client controller.

2) If you did bring the custom as a variable type macro you would use g_form with this syntax:

$scope.page.g_form.getValue('number')

 

Here is an example:

I set the options to use a Custom URL syntax setting page, table, sys_id, and an extra param showMessage.

Page = the page to redirect to. My example uses the page with "ticket" as the id.

Table = the incident table since this will be a record producer creating an incident

Sys_id = will be the incident record that was created as the end result of submission

showMessage = true. This is here because I'm using an OOB page and sometimes this page could be accessed from a different source and not necessarily after a catalog item submission

 

Server and Client controller scripts of the custom widget

find_real_file.png

 

Adding custom widget to the ticket form page

find_real_file.png

 

Setting the options on the SC Catalog Item widget instance

find_real_file.png

 

Url redirected to after successful catalog item submission

find_real_file.png

 

successful redirect to ticket form page with added info message

find_real_file.png

Hi Chris,

The showMessage thing isn't working for me. It is always false and the message never gets displayed.

Do you have any suggestion as to how to check if is new record?

Thanks,

Dana

Hmmm. What version of instance are you working with? Kingston has changed a little for catalog redirection (Page Mapping).

If before Kingston, what page are you directing to?
Does that page have a widget that looks for that "showMessage" option?
From my previous post the showMessage is being hardcoded to true thus should always be true unless again the page being redirected to doesn't look for that option, or the widget itself is hardcoded to false for that option, or another script is overriding your redirect and something else is setting the url.