How to display a pop up with field when we click on ui action?

Deepika61
Tera Contributor

Hi All,

Actually we have requirement that, basically on the catalog task in workspace we need a ui action "Ask approval" when we click on that need to display a pop with Approver field ,Actually already we have approver field on catalog task form , so we need to display that field on pop up , when we we select approver and click on , ok, then it needs to update that field with approver

 

Please help me to achieve this

 

Thanks

Deepika

8 REPLIES 8

@Deepika61 

then when they select the approver on popup it should send an approval to that user?
if yes then you can use UI page and invoke it from UI action in workspace

How to use UI Actions in Workspaces 

there is a syntax to open UI page

this is the syntax

var ui_page_id = '<sys_id_of_your_ui_page>';
    g_modal.showFrame({
        url: '/ui_page.do?sys_id=' + ui_page_id,
        title: 'Choose a template',
        size: 'xl',
        height: 500
    });

reference: UI page on Agent workspace 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

@Deepika61 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Deepika61 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

M Shivani
Tera Guru

Hi @Deepika61

Use the below code in Workspace client script in UI Action : 

Name - Ask Approval 

Script - 

function onClick(g_form){
g_modal.showFields({
title: "Approver",
fields: [{
type: 'reference',
name: 'approver',
label: getMessage('Approver'),
mandatory: true,
reference: 'sys_user',  // reference table of the approver field
referringTable: 'sc_task'  // table on which ui action is visible

referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('approver'), 
displayValue: g_form.getDisplayValue('assigned_to')


}, ],
size: 'md'
}).then(function(fieldValues) {
g_form.setValue('approver', fieldValues.updatedFields[0].value);  // first string to be the backend value of approver field on sc_Task
g_form.save();
});

}

Regards 

Shivani