[Help] Modal Buttons & Forms

Jordan14
Giga Expert

Hello,

I'm looking to create a modal button in the service portal which displays my password reset form.

Anyway to achieve this?

I've seen some similar posts and it doesn't seem to help me.

To start with, I've used "Serviveportal.io" code to display the modal, but I haven't had any luck with trying to display the password reset form.

 

Any help is appreciated.

Thanks,

Jordan

8 REPLIES 8

Matthew Glenn
Kilo Sage

Build your button in the Body HTML Template:

<button class="btn btn-primary" ng-click="c.openModal()">Click me</button>

 

In the Client Controller, add the spModal parameter to your function declaration. Something like this:

function ($scope, spUtil, snRecordWatcher, spModal) {

 

Finally, add your modal code in the Client Controller:

 

    c.openModal = function(){
		spModal.open({
			widget: "d4e159841302fa00ba1530128144b092", //The sys_id of the widget you'd like to call
			size: "lg",
			buttons: [{label:'✘ ${Close}', cancel: true}],
			widgetInput: {sys_id: "cd6c58d013362200ba1530128144b042"} //the sys_id of your cat item. I believe the name may work here as well, but I've never tried it
		});
	},

 

Additional options for the .open function (size, buttons, etc.) can be found here

 

Hope this helps

 

Hi Matthew,

 

Thanks for the reply, I have a quick question.

 

How do I get the sys_id of  widgets on the portal?

 

Thanks,

Jordan

Hi Matthew,

 

I've followed your code but it isn't quite what I'm looking for.

 

Looking at the screenshot below you can see it just displays the widget instead of opening it.

find_real_file.png

any ideas?

 

Thanks,

Jordan

Widget Code: 

HTML:

 

<div>
<button class="btn btn-primary" ng-click="c.openModal()">${Open Modal}</button>
</div>

 

Client Script:

 

function($uibModal, spUtil, spModal, $scope) {
var c = this;

c.openModal = function() {
spModal.open({
widget: "752893094f45978021a168d18110c713", //add widget sys_id
size: "lg",
buttons: [{label: '✘ ${Close}', cancel: true}],
widgetInput: {sys_id: "752893094f45978021a168d18110c713"} // add cata item sys_id
});
}
}