‎09-21-2017 11:39 AM
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);
}
}
‎09-22-2017 09:53 AM
on client side code of the widget use the spModal.open(Object options).then(function(){})
‎09-22-2017 10:52 AM
I've seen this all over - just need more help -- a deeper dive.
‎11-28-2017 06:58 AM
Hi Blair, did you manage to solve this issue? I have the same requirement...
‎08-23-2022 06:36 AM
Hi
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
});
};