service portal

How to validate a date format in service portal

So a few weeks ago someone had asked how to do some “How to validate a date format in service portal?“ So this came up in a chat I was having this week. To use the g_user_date_format, g_user_date_time_format and getDateFromFormat(), you would have to re-include the JS file that declares these things. To do that goto the widget where you get a failure message and add a new dependency to a new UI script where you copy/paste the code from https://hi.

Service Portal - Viewing whats loaded on the page

This is blatantly taken from HI as this I think is useful enough to re-post nearly verbatim. If you’ve ever needed to know exactly which Client Scripts, UI Policies, and UI Actions are loading onto the page when you view a form or Service Catalog item in Service Portal, the information is readily available if your know where to look. If you are using the out-of-box “SC Catalog Item” and “Form” widgets, you can find this information in the widgets scope.

London Variable Sets Table

I had to try this out and since the docs don’t really show how it works here’s screenshot and video. Here’s a video showing the parts of this. It’s pretty neat the content if you do a g_form.getValue('variableSetName'); is a stringified JSON array. g_form.getValue('questions'); returns below /* "[ { \"order\":\"100\", \"question\":\"What do you need help with?\", \"required\":\"Yes\", \"help_text\":\"\" } ]" */

Set up add to cart in Service portal

So it seems the first thing a lot of places have to do when setting up the service portal is to re-setup two-step-checkout. Because I’ve had to do this a few times and don’t like looking it up here’s the steps I’ve followed to set it up; Adding “Add Cart” on the form On your catalog item widget, ctrl + right click the widget and open the widget instance options.

Setting variables via URL Scheme on Service Portal

The other day, a post was made, asking how to do this and I had to answer. I knew you could read the URL via $window but that isn’t available in client scripts. So how can this be done? I came up with the following solution. Create a Variable type of macro, with a widget that has the following client script; function($scope, $window) { // This is the controller, we've included // $scope in the function above because // it's easy to work with var c = this; // We are going to simplify accessing // g_form within the client script by // setting it as a variable named g_form var g_form = $scope.

Service Portal: Broadcast, emit, and on, should I use them?

Broadcasting messages seems great when you first learn about them and start to use them but it seems they, like everything, has its pros and cons. As such I’d avoid them for the following reasons. It’s all client side, meaning it can be spoofed and modified. Its extremely difficult to track down where something broke. Imagine you have 3 things all calling the same broadcast message to update a title or breadcrumb, and then one fails.

Code Search Updated

After some back and forth between the creator of the sn_codesearch app Cory Seering I have a better understanding of how this works. This scoped app now uses its own search group to search 49 tables instead of the default 29. It now includes everything OOB I can think of that could run code server/client side. Setup Open Studio on your environment Import from source Paste in the following URL: https://github.

Instance options can change CSS

Turns out you can apply CSS to a instance record I had no idea you could do this. This may have saved me from cloning a few widgets had I known. If you ctrl+right-click a widget and open the Instance in Page Editor you can apply CSS to supersede the css defined in the widget. This is a short and sweet tip.

Serice Portal Record Producer Redirects

So the other day I was asked to set up the redirect from a record producer on the Service Portal. This was no problem in the past CMS, and the normal GUI. The docs say it should just be a simple line of code like; producer.url_redirect="";//for CMS and GUI redirects producer.portal_redirect="?id=page";//for Service Portal redirects However this does not work unless you modify the Instance Options (control-right click, to get to “Instance Options”).

Service Portal Pasting Images

In the past I’ve tried to set up image pasting before with Lars Tange’s solution, but that didn’t look how I liked it, as it had a specific field for pasting attachments. I am cleaning up some of my former stories and thought I’d do a cusory search and found this post by Christopher Decugis about how he modified it to work. It works great. Below I’ll go over what you need to do if you want this on your portal as well.