UI action - pop up modal window..

Community Alums
Not applicable

Hi All,

I have a custom table "Table X" , i have also created a form link UI action "Generate Task". When i click this ui action, a pop up window should come with two fields "Assignee" ref to sys_user table & "Assignment Group" refer to group table.

When user fills the form it should generate a catalog task record. How can i achieve this?

*************************************

Action name : show_dialog_form

Client : true

Onclick : openForm();

*************************************

function openForm() {
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var gDialog = new dialogClass('show_dialog_form');
gDialog.setTitle(new GwtMessage().getMessage('Create Task'));
gDialog.render();
}

how to proceed after this? Do i need to create any UI page for that popup window with those two fields.

Regards,

Sirraj

1 ACCEPTED SOLUTION

Hi,

You can create the task from the processing script of the UI page itself

You cannot get directly the value from Modal to the UI Action Script

Please share the UI page HTML, Client Script and Processing Script you have used

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Hi,

You can create the task from the processing script of the UI page itself

You cannot get directly the value from Modal to the UI Action Script

Please share the UI page HTML, Client Script and Processing Script you have used

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Community Alums
Not applicable

@Ankur Bawiskar 

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:ui_form>
<table>
<tr>
<td style="width:25%">
<g:form_label> Assessor </g:form_label>
</td>
<td style="width:60%">
<g:ui_reference name="user_ref" id="user_ref" table="sys_user" />
</td>
</tr>
<tr>
<td style="width:25%">
<g:form_label> Assignment Group </g:form_label>
</td>
<td style="width:60%">
<g:ui_reference name="metric_ref" id="metric_ref" query="nameLIKEEXT" table="sys_user_group" />
</td>
</tr>
<tr>
<td>
<g:dialog_buttons_ok_cancel ok_id="submitData" ok="return continueOK()" ok_type="button" ok_text="${gs.getMessage('Okay')}" ok_style_class="btn btn-primary" cancel_type="button" cancel_id="cancelData" cancel_style_class="btn btn-default" cancel="return continueCancel()" />
</td>
</tr>
</table>
</g:ui_form>
</j:jelly>

Client & Processing Script : 

find_real_file.png

Regards,

Sirraj

Hi,

update as below

1) remove line 4 from processing script

2) also createTasks function -> how would it know for which record to create tasks; check that once

var user = request.getParameter("user_ref");
var group = request.getParameter("metric_ref");

// ensure you pass the proper gliderecord object
var survey = new global.AssessmentUtils().createTasks(group, '', user);

var urlOnStack = gs.getUrlOnStack();

response.sendRedirect(urlOnStack);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader