- 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 09:58 AM
Hello,
Check out this post about Glide Dialog Windows, https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/ And adding references. https://www.servicenowguru.com/system-ui/ui-macros/adding-referenced-records-leaving-form/
They are both really helpful. I also came across this post from community that looks to be similar to what you're doing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 11:27 AM
Hi Cody,
The community post that you posted is exactly what i wanted but can you help me to understand how will i make sure that the record that was created by submitting from the dialogue window is tagged to that incident ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 11:46 AM
I see that a record is getting created but unable to link it to the parent incident.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2019 12:25 PM
How are you setting up your related list? Or how are you linking the 2?
My suggestion would be to add a "Parent Incident" or some other field to the u_team_activities table, where when you open that dialogue you set the new field as a reference to whatever record you just opened it from.
Then on the incidents related list have it look for all records on the u_team_activities table with its own record as the reference.