Help with a UI action

Andrew_TND
Mega Sage
Mega Sage

Hello, 

Wondering if someone can help me fix this UI action, I've received a requirement to add a button at the top of the form which gets all problem tasks related to that record, however no joy as I cant seem to get it to pull the parent sys_id.

function showMyWindow() {
	
	var tableName = 'problem_task';
	var sysID = -1;
	var Sysid = g_form.getUniqueValue();
	
	var dialog = new GlideDialogWindow('Problem Tasks', tableName); 
dialog.setSysID(sysID);
dialog.addParm('sysparm_view', 'default');
dialog.addParm('problem', current.sys_id);
dialog.setLoadCallback(function(iframeDoc) {
	
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
	dialogFrame.g_form.getValue('parent', Sysid);
	dialogFrame = null;
});
dialog.render();
}


Thanks in advance!

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi
why do you want to reinvent the wheel as you can already enable that list of problem tasks as a related list at the end of the form!

Instead of implementing everything someone require you should explain that you not only have to implement it in one experience but also maybe inthe Service Portal, in any Workspaces or in the Mobile App. 

I have explained the benefit of the related list, however its to complement the existing related list functionality.

You can get working examples at http://servicenowguru.com/system-ui/glidedialogwindow_popup_record_list/ as your code makes absolutelyno sense.

SANDEEP28
Mega Sage

@Andrew_TND are you creating button on Problem record form to get problem tasks related to the same problem record ?

There is already a OOB related list "Problem Task" available on Problem record, you can use the same. 

 

SANDEEP28_0-1690133698203.png

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!