Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Service Portal - GlideModal Help

Blair5
Giga Guru

I want to convert one of our catalog client scripts which opens a glide dialog to a widget. It's a fairly simple dialog which opens a new user record in the pop up and allows a user to add a new one. Not the greatest coder and need help converting the below:

function addEditPop(){

var dialog = new GlideDialogForm('Add Unregistered User', 'sys_user', setUserField);

dialog.setSysID('-1'); //Pass in -1 to create a new record

dialog.addParm('sysparm_view', 'unregistered_user'); //Specify a form view

dialog.addParm('sysparm_form_only', 'true'); //Remove related lists

dialog.render(); //Open the dialog

//Callback function executed from dialog submit

function setUserField(action, sys_id, table, displayValue){

//Set the user field with the popup user

g_form.setValue('requested_for23', sys_id);

}

}

4 REPLIES 4

vrfox
Giga Contributor

on client side code of the widget use the spModal.open(Object options).then(function(){})


I've seen this all over - just need more help -- a deeper dive.


Hi Blair, did you manage to solve this issue? I have the same requirement...


Hi @Blair   and @reginabautista 

Here is a code sample

Put this in the Client side code in your widget. And then this onConfirm function put to be triggered by press of the button you have.

	$scope.onConfirm = function() {
        //ask the user for a string
        spModal.open({
            title: 'Reason for reopening',
            message: 'Please provide a reason for reopening this incident.',
            input: true,
            value: c.name
        }).then(function(name) {
            $scope.data.reOpenComment = name;
			console.log($scope.data.reOpenComment);
			$scope.reopenIncident(); //this runs another function in the same Client side Code
        });
    };