Ui Action button is not working in UI native

manju12
Tera Expert

Hi Team,

 

I have one Reject button created in UI action, this button is working in workspace but same button is not working in native View.. It is throwing undefined onclick.. Shared the screenshot below. Please help me out..

 

manju12_0-1774330212811.png

 

Thanks,

Manju

1 REPLY 1

ayushraj7012933
Mega Guru

 

Hi @manju12 ,

The error openCommentForControl is not defined clearly indicates that the function used in your UI Action onclick is not available in Native UI, even though it works in Workspace.

Root Cause

  • The function is likely defined in Workspace (UI Builder / Client Script)

  • Native UI does not load those scripts

  • Hence, onclick fails with undefined function

  • Step-by-Step Solution

Step 1: Check UI Action Configuration

  1. Go to System Definition → UI Actions

  2. Open your Reject button

  3. Verify:

    • Client = true

    • Onclick:

       
      openCommentForControl();
      Step 2: Create Client Script for Native UI
  1. Go to System Definition → Client Scripts

  2. Click New

Configure:

  • Table: same as your UI Action table

  • Type: onLoad

Step 3: Define the Function

Add this script:

function openCommentForControl() {
var comment = prompt("Enter rejection comments:");
if (comment) {
g_form.setValue('comments', comment);
}
}
 

This makes the function available in Native UI

Step 4: Test the Button

  • Open the record in Native UI

  • Click Reject

  • It should now:

    • Prompt for comment

    • Populate the field