- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 09:18 AM
Hi Team,
I would like to know how can i use a UI action to open form in the dialog window ?
1.UI action on the incident form.
2.Clicking on it should open a new record form of a custom table (u_team_activities)
3. Team activities table will be a related list under the incident form.
4.Clicking on submit should create a record in the team activites (u_team_activites) table and record should show up in the related list.
Need advise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 12:13 PM
Hi David,
This below code will work for your requirement.
function showMyForm(){
//Get the table name and sys_id of the record
var tableName = 'problem_task';
var sysID = -1;
var incSysid = g_form.getUniqueValue();
alert(incSysid);
//Create and open the dialog form
var dialog = new GlideDialogForm('Create Problem Task', tableName); //Provide dialog title and table name
dialog.setSysID(sysID); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'default'); //Specify a form view
dialog.addParm('problem task', 'true'); //Add or remove related lists
dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
dialogFrame.g_form.setValue('u_incident', incSysid);
dialogFrame = null;
});
dialog.render(); //Open the dialog
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 12:13 PM
Hi David,
This below code will work for your requirement.
function showMyForm(){
//Get the table name and sys_id of the record
var tableName = 'problem_task';
var sysID = -1;
var incSysid = g_form.getUniqueValue();
alert(incSysid);
//Create and open the dialog form
var dialog = new GlideDialogForm('Create Problem Task', tableName); //Provide dialog title and table name
dialog.setSysID(sysID); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'default'); //Specify a form view
dialog.addParm('problem task', 'true'); //Add or remove related lists
dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
dialogFrame.g_form.setValue('u_incident', incSysid);
dialogFrame = null;
});
dialog.render(); //Open the dialog
}