Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action not working on click

Bidduam
Tera Guru

So I have created a UI Action, the idea is when a button is clicked on an asset form a modal window will appear with only the required fields via a particular view I have created, however when I click the button nothing at all happens, not even an entry in an logs that I can find. I'm guessing it is something pretty simple, but can't see the cause for the life of me.

The buttons shows correctly:

Bidduam_0-1665538617828.png

 

The view created is called "Returned"

 

Bidduam_2-1665538686557.png

 

The UI Action is:

Name: Return Asset

Table: Asset {alm_asset}  (Have also tried alm_hardware, same result)

Oder: 100

Application: Global

Action Name: BLANK

Active: checked

show insert: checked (also tried unchecked same issue)

Show Update: checked (also tried unchecked same issue)

Client: checked

List v2 compatible: checked (also tried unchecked same issue)

Form button: checked

Form style: Unstyled (have also tried none, same issue)

Onclick: showReturnForm()

Script:

function showRetunForm(){
   //Get the table name and sys_id of the record
   var tableName = g_form.getTableName();
   var sysID = g_form.getUniqueValue();

   //Create and open the dialog form
   var dialog = new GlideDialogForm('Return Asset', 'alm_asset'); //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', 'Returned'); //Specify a form view
   dialog.addParm('sysparm_form_only', 'true'); //Add or remove related lists
   dialog.render(); //Open the dialog
}

 

 

1 ACCEPTED SOLUTION

Bidduam
Tera Guru

It would appear I had some sort of typo in the onclick text, when I copied and pasted it from the script into the onclick field and retested, all is now working

View solution in original post

1 REPLY 1

Bidduam
Tera Guru

It would appear I had some sort of typo in the onclick text, when I copied and pasted it from the script into the onclick field and retested, all is now working