In Agent workspace,g_modal.showfields we use .then and give code to execute if the user clicks OK button , Can you help me what function we need to use to give the code when the user clicks Cancel

Vinodhini
Kilo Contributor

In Agent workspace,g_modal.showfields we use .then and give code to execute if the user clicks OK button , Can you help me what function we need to use to give the code when the user clicks Cancel

6 REPLIES 6

Sai Kumar B
Mega Sage

@Vinodhini 

You can refer to this blog for all the information related to g_modal

https://www.ashleysn.com/post/workspace-ui-actions

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can refer many OOB UI actions for this and check how they use it

Sharing good link for your help

Workspace UI Actions

it uses the .then function

g_modal.showFields({
            title: "Choices for Change Request",
            fields: fields,
            size: 'lg'
        }).then(function(fieldValues) {

            // this code will run when OK is clicked
            
        });   

Few OOB UI Actions

find_real_file.png

 

Regards
Ankur

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

Thank you for the reply!

I used .then function in my code for executing if the user clicks OK.

My question is if the user clicks on Cancel i need to reload the form . I am not able to find which function to use

Hi,

check this link if it helps for cancel button

https://community.servicenow.com/community?id=community_article&sys_id=a9b8e73c1b5e0110be4955fa234bc...

find_real_file.png

Regards
Ankur

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