Hi All,

Welcome back. I m very glad to bring this video to you. Today we will be looking at something which really pleased me a lot and I was looking for something like this for a long time.
Today we will be looking at how we can Enhance your Catalog Items with Contextual Popups. We all must have catalog item sometime and we must have used the alert or window, confirm which will help us to complete our requirement but its, not eye-pleasing experience.

Let’s first try to understand what is SpMoldal class?
– Show alerts, prompts, and confirmation dialogs in Service Portal widgets. The ServiceNow SpModal class is available in Service Portal client scripts.
– You can use ServiceNow SpModal.open() to display a widget in a modal dialog. The ServiceNow SpModal class is a lightweight wrapper for Angular UI bootstrap’s $uibModal.
ServiceNow SpModal is a lightweight wrapper for Angular UI bootstrap $uibModal that is used frequently in Service portal widgets to present various forms of popups. But did you know it can be used within a catalog client script!

* ServiceNow SpModal Alert
– This is one of the simplest implementations and is a direct replacement for the window.alert() method. It takes in a message and will display a popup with the instance theming.
– What’s this .then() all about? All modals instantiate a promise which invokes the function within the .then() parameter on the closure of the modal. This allows you to do some funky things with the other ServiceNow SpModal versions. For ServiceNow SpModal.alert() this just returns true if the user clicks the ok button.

* ServiceNow SpModal Confirm
– Similar to ServiceNow SpModal.alert(), the confirm option has the same basic setup but with a cancel button in addition to the ok button.

* ServiceNow SpModal Prompt
– As the name might suggest, this option gives you the ability to prompt the user for a value which is then passed back to the promise for you to use. You can pass a default value that the user can overtype.

* ServiceNow SpModal Open
– This is by far my favorite option as it gives you direct access to the functionality available in $uibModal and greater flexibility. It might seem a little intimidating due to the number of options but it’s definitely worth it.


Please follow subscribe to my channel Technomonk and press the bell icon to get the latest update on my new videos.
Till then stay happy and safe.
Have a nice day.

Regards,
Amit Gujarathi

technomonkadmin

View all posts

Add comment

Your email address will not be published. Required fields are marked *