The CreatorCon Call for Content is officially open! Get started here.

OK and Cancel buttons on pop-up - Resolve dialog form view

adinad
Tera Guru

Hi,

In problem workflow, I edited the form "Resolve dialog form view" and want to be displayed as pop-up on "Resolve" button. 

I edited the UI Action - Resolve, with the script:

--------------

function onResolve() {

var tableName = 'problem';
var sysID = g_form.getValue('sys_id'); // sys_id of the record you want to show

//Create and open the dialog form
var dialog = new GlideDialogForm('Resolve', tableName);
dialog.setSysID(sysID); //Pass in sys_id to edit existing record,
dialog.addParm('sysparm_view', 'resolve_dialog_form_view'); //Specify a form view
dialog.render();

}

--------------

The correct pop-up is displayed, but are missing Ok and Cancel buttons.

I edited also, in the Ok and Cancel buttons, in list - UI Action Visibility - to include the view "Resolve..", but still, the buttons are missing on the pop-up.

Am I missing something?

Thanks,

Adina

1 ACCEPTED SOLUTION

adinad
Tera Guru

After I created a dedicated client script for the resolve view and field "

 

The client script - Modals for Problem state transition - didn't impacted in any way the other views.

View solution in original post

22 REPLIES 22

As per button ID, seems ok button is renamed as submit. Also, check is there any UI action for cancel

For problem, there are dedicated UI Actions for OK and Cancel button

- This UI action is for the cancel action in Problem Management  State Transition Modals.

 

The buttons exist, and if I change the view of the problem, the buttons are displayed. They are not displayed on pop-up.

Hi,

Did you try the solution which I have proposed. step by step solution I have given below.

Let me know if you are facing an issue. Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

Hi,

Please follow the steps below to achieve your requirement:

1) Modify your Resolve UI Action on Problem Table with Script as below:

function onResolve() {

    var tableName = 'problem';
    var number = g_form.getValue('number'); // sys_id of the record you want to show

    //Create and open the dialog form
    var gdw = new GlideDialogWindow("renderProblem");
    gdw.setTitle("Resolve Problem Record");
    gdw.setPreference('tableName', 'Problem');
    gdw.setPreference('prbID', number);
    gdw.render();

}

find_real_file.png

2) Now once this is done, create a new UI Page named "renderProblem" which is same as referred to in UI Action above:

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:evaluate var="jvar_v1" jelly="true" expression="RP.getWindowProperties().get('tableName')" />
	<g:evaluate var="jvar_v2" jelly="true" expression="RP.getWindowProperties().get('prbID')" />
	
	  
	<TABLE BORDER="0" width="600">
		<TR>
		<TD>
				<span id="var1">${jvar_v1}</span>
			</TD>
			<TD>
				<span id="var2">${jvar_v2}</span>
			</TD>
		</TR>	
 <TR>
     <TD>
  Below button are used to Resolve the Problem Record
</TD>
</TR>
<TR>
 <TD align="right">
 <!-- Include the 'dialog_buttons_ok_cancel' UI macro -->
	 <button type="button" onclick="OK()">OK</button>
	  <button type="button" onclick="Cancel()">Cancel</button>

</TD>
 </TR>
</TABLE>

</j:jelly>

Client:

function OK(){
	var getPRBID = g_form.getUniqueValue();
	g_form.setValue('state',106);
	GlideDialogWindow.get().destroy();
}

 

UI Page Screenshot:

find_real_file.png

Output:

This displays the button correctly and on click of OK it makes the problem as Resolved as well.

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi Shloke,

Your solution is working.

But I wanted to used the OOB views.

Thanks,
Adina