Displaying a specific message after Record Producer submission (update) in the Service Portal

Wesley Breshear
Tera Expert

Hello,

I am using a catalog form to update a record on the Product table (rm_product).  My form is a Record Producer form so during submit my record producer script uses this command so a new record is not generated. 

current.setAbortAction(true);

But then I get directed to a page that says "No record found.".  This would seem expected but very confusing to the user updating the record.  I have been able to redirect the user from the page that says "No record found." by using this command.

producer.portal_redirect = 'https://' + instanceName + '.service-now.com/sp?id=sc_cat_item&sys_id=686a62521bb9b7002240a79b2d4bcb88';

However, I am still struggling in getting a message or confirmation box to appear to the user telling he/her "The Product record has been updated."  gs.addInfoMessage("Record is updated."); is not working in the Service Portal and I have seen some articles talking about using spUtil.addInfoMessage("Your message"); but adding it to the catalog form widget which I don't think that I can do because the widget is used for all forms and I don't want this message appearing during other submissions.  I am not aware of how to have a specific widget or instance be used for a specific record producer form if so that might be a solution. 

Any other ideas?

Thank you,

-Wesley

8 REPLIES 8

@Wesley Breshear I'm in same situation now to get info message displayed only for a specific record producer after submitting on Service Portal
Did you ever get it worked, if so How ? Thankyou

Hi Naresh,

No, I was not.  The Client decided it wasn't a major issue, so we canceled the story to make the message viewable.  Sorry, I can't be helpful.

-Wesley

I have done some similar things calling different logic depending where the user is and this is an option you can use to apply to your requirement.

 

Create yourself an OnLoad client script with a UI type of "All".

 

Create your functions in this onLoad script that you want to call.

 

In this instance, I needed to show a confirmation pop-up in the portal and native UI depending on where the user raised it.

 

g_user.showAlertPlatform = function(msg) {
// NATIVE FUNCTION LOGIC
};
 
g_user.showAlertServicePortal = function(msg) {
// PORTAL FUNCTION LOGIC
};
 
Then an onSubmit client script calling the functions based upon where you are.
 
// Check if spModal is defined - are we on the service portal?
    if(typeof spModal !== 'undefined') {
        // We're on the service portal so call the portal function from the onLoad
        g_user.showAlertServicePortal('{MESSAGE HERE}');
        return false;
    }
else {
        // We're on the base platform so call the native function from the onLoad
        g_user.showAlertPlatform('{MESSAGE HERE}');
        return false;
    }
 
I know it's not the exact answer your issue but should put you in the ball park to sort it.
 
Thanks,
Dan

Alikutty A
Tera Sage

Hi Wesley,

gs.addInfoMessage should work on the catalog form widget in portal. Please try to use this code.

current.setAbortAction(true);
gs.addInfoMessage("Error message");
producer.redirect = "com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=SYS_ID_OF_RECORD_PRODUCER";

This is taken from an OOB Record producer which works in both platform and portal, You could test it out in your PDI and use the same logic.

Here is its URL:  https://instance_name.service-now.com/nav_to.do?uri=sc_cat_item_producer.do?sys_id=255d3c947f0000011e3d3dd191fa8795