Overriding the ess Checkout View for Catalog Requests

///Overriding the ess Checkout View for Catalog Requests

Overriding the ess Checkout View for Catalog Requests

S

erviceNow’s service catalog interface is designed to give users a more familiar “Amazon.com-like” ordering experience. While this interface meets the needs of most customers, there are areas where certain modifications may be desirable. One of these areas may be the catalog checkout page. The out-of-box setup always presents every user with a specific checkout or ‘ess’ view for the ‘sc_request’ (Request) table. This checkout page is forced every time any user attempts to view a request record using the ‘ess’ view.

But what if you would rather use the standard ‘ess’ view that is similar to the rest of the forms in the system? Something like this…?

While this isn’t a typical modification, this article shows how you could accomplish it.

This modification requires an override of out-of-box Service catalog functionality that may cause issues with later upgrades. You should make a note of any of these modified records so that you can restore them to their out-of-box state in the future if necessary. Please also note that while this modification may be useful in certain situations, the vast majority of ServiceNow implementations do not require it.

1Navigate to the ‘Navigation Handlers’ table by using the following URL (‘https://your-instance-name/sys_navigator_list.do’) or by typing ‘sys_navigator.list’ in the left navigation search bar.

2Open the ‘sc_request’ record and change the ‘Table’ field value to ‘–None–‘. This effectively disables the navigation handler that overrides the ‘ess’ view for the ‘sc_request’ table.

Next, you need to force the standard ‘ess’ view when a user sees the request record immediately after submitting a request.

3Open the ‘com.glideapp.servicecatalog_checkout_view’ (‘com_glideapp.servicecatalog_checkout_view_v2’ for newer instances) UI page under ‘System UI -> UI pages’ and change the name to ‘com.glideapp.servicecatalog_checkout_view-OLD’ (‘com_glideapp.servicecatalog_checkout_view_v2-OLD’ for newer instances)

4Create a new UI page with the following settings…

UI page
Name: ‘com.glideapp.servicecatalog_checkout_view’ (‘com_glideapp.servicecatalog_checkout_view_v2’ for newer instances)
Description: The final “checkout” screen you see in the service catalog after a successful order is placed.
Note: This page is an override of the out-of-box UI page for checkout. It redirects the user from the out-of-box checkout page to a standard ‘ess’ view for the ‘sc_request’ table if there is more than one item in the request and to the ‘ess’ view for the ‘sc_req_item’ table if there is only a single item in the request.
HTML:

<?xml version='1.0' encoding='utf-8' ?>
<j:jelly trim='false' xmlns:j='jelly:core' xmlns:g='glide' xmlns:j2='null' xmlns:g2='null'>
    <g2:evaluate jelly="true">
        var item_id = '${sysparm_sys_id}';
        var item_table = 'sc_request';
                                                   
        var sc_req_item = new GlideRecordSecure('sc_req_item');
        sc_req_item.addQuery('request', '${sysparm_sys_id}');
        sc_req_item.query();
        if(sc_req_item.getRowCount() == 1){
            sc_req_item.next();
            item_table = 'sc_req_item';
            item_id = sc_req_item.sys_id;
        }
    </g2:evaluate>
    <script language='javascript'>
        addLoadEvent(overrideView);
        function overrideView() {    
            var url = '$[item_table]' + '.do?sys_id=' + '$[item_id]' + '$[AMP]sysparm_view=ess';
            window.location = url;
        }  
    </script>
</j:jelly>

5Verify the security for all of the elements and related lists on the new form. Since this view is not designed for use by ‘ess’ users out-of-box, you’ll need to make sure that the security on the request and request item tables meets the needs of your organization.

Overriding the Request Item (sc_req_item) ess viewThe default behavior for users with no role is to force the ‘ess’ view for the Request Item table. If you find it necessary to override the ess view for the Request Item table you can modify or disable the ‘Catalog Scripts’ AJAX Script record. You can find this record by navigating to ‘System Definition -> AJAX Scripts’ if that module is active in your instance or you can enter ‘sys_script_ajax.list’ in your left navigation filter to navigate directly to the list without a module.

By | 2018-07-09T15:00:12-06:00 March 8th, 2010|Categories: UI pages|Tags: , |18 Comments

About the Author:

18 Comments

  1. alli March 8, 2010 at 3:15 pm - Reply

    Hi Mark,

    What if I just want to change the words in the out of the box checkout page? Like I want to remove the bookmark statement cause it might cause confusion to end users. where should I edit this?

    as always your timing with your post is perfect!!

    cheers

    Alli

    • Mark Stanger March 8, 2010 at 6:59 pm - Reply

      The information for the out-of-box checkout page is in the ‘com.glideapp.servicecatalog_checkout_view’ UI page from step 3 above. If you wanted to remove the bookmark link, you would just need to search for and remove this section of code from the page.

      ${gs.getMessage('You may also bookmark the following link to get back to')}$[SP]
       
      <a class="linked" id="permalink" target="_top" href="nav_to.do?uri=$[permalink]">$[sc_request.number]</a>.
       
      <br /> ${gs.getMessage('bookmark_link_help_note')}
  2. alli March 9, 2010 at 12:00 am - Reply

    Thanks Mark,

    It’s working, as always

    Cheers

  3. Kevin Sandberg June 13, 2012 at 9:40 am - Reply

    Hi Mark,

    This looks perfect to what I achieve but lacks one vital thing – I need to go to the Standard ‘Out of The Box View’ for certain items and the alternative view for others. I know this is a long shot but when you have catalog items which are not ‘physical’ items the Out of The Box View does not make any sense. Even if I could skip the initial ‘servicecatalog_checkout_one.do’ and go straight to the final Order Summary?

    Thanks,

    Kev

    • Mark Stanger June 13, 2012 at 10:47 am - Reply

      I wish I had a good answer for you but I don’t. I’m sure it’s possible with some UI page hacks and maybe a custom catalog cart but it’s not something I’ve got a solution for at the moment.

  4. Abhiram Diddigi February 20, 2013 at 10:24 pm - Reply

    Hello Mark,

    Where can I find how the system is navigating to com.glideapp.servicecatalog_checkout_view page?

    In our instance, I don’t know how, But its navigating to a custom UI Page.

    Thank you!

    Abhiram Diddigi

    • Mark Stanger February 21, 2013 at 6:44 am - Reply

      The only place I know of is the ‘Navigation handlers’ table that I indicated above in the article. Have you checked there?

  5. Arindam Dutta January 31, 2014 at 2:57 am - Reply

    Hi Mark,

    I need two step checkout for catalog request and one step check out for wizard. How I can handle that scenario. Is there any way to achieve this without customized the SNC provided UI Page(com.glideapp.servicecatalog_cart_view) and UI Macro. Is there any way to bypass the final checkout screen from shopping Cart screen.

    • Mark Stanger January 31, 2014 at 6:56 am - Reply

      I haven’t looked at that much so I don’t know for sure. I don’t use wizards as a general rule because I’ve found them to be buggy in the past. You might ask on the SN community and see if anybody has dealt with this problem already.

  6. Simon April 9, 2014 at 2:12 am - Reply

    Thanks Mark. Working great.

    What would be a good option to let the users know their request has been submitted? Redirecting the users to the traditional ESS form is great but could sometime be confusing since there isn’t a true confirmation that the request has been submitted. Maybe some text on top of the ESS form or a notification popup stating “Your Request Has Been Submitted”? Can you share how to implement such a confirmation please?

    Thanks.

  7. Yvonne December 10, 2014 at 12:58 pm - Reply

    Hello Mark – I would like my client to see the order summary when they complete their order but when they go to “My Request” and open the request, I would like them to get an ess view of the request. OOTB, they are getting the order status page when they click on the request number and not the ess defined fields.

    Thoughts?
    ~Yvonne

    • Mark Stanger December 10, 2014 at 1:19 pm - Reply

      I think that’s exactly what this solution describes. Have you configured the system as outlined in this article?

      • Yvonne December 10, 2014 at 2:15 pm - Reply

        yes. I did configure as described and when I go order, now it takes me directly to the request page not the order summary.

  8. Kim April 6, 2016 at 12:58 pm - Reply

    This is great — I’ve got it all working except 3/4. My ess page view is named “Self Service” but it seems my end users are being directed to the default view when checking the status of a sc_request ticket. I tried creating a view called “users” and updated the UI page code, but no effect.

  9. Eric Pace March 28, 2017 at 5:06 pm - Reply

    How about redirecting them to the RITM record that is associated? I understand that many people use them as a one to many, our Request & Request Items are always a 1:1 (we just Catalog Tasks and Variables for our needs)

    • Mark Stanger March 28, 2017 at 6:11 pm - Reply

      Good idea! I just updated the script above to do this. I also made it smart enough to detect whether or not there is only one item in the request. If there is only one it goes to the item view, if there are more it goes to the request view. Give it a test and let me know how it works!

  10. Eric Pace March 29, 2017 at 1:13 pm - Reply

    This works perfectly! Thank you!

Leave A Comment