How can I extract Field values?

Udbhav
Tera Contributor

How can I extract drop down field values and show them in an alert box?

Udbhav_0-1699857426857.png

Like here in the picture, how can I extract all these State field values and also in case of Reference field?

7 REPLIES 7

Jaspal Singh
Mega Patron
Mega Patron

Hi Udbhav,

Drop-down choices will be in sys_choice table. You can filter by required table and field to get specifics.

For Reference, it will the table being referenced. What is the exact use case?

 

Hi Jaspal,

Actually I was facing issue in writing script.

If I want to write -->

       If (state == "in progress"){

               [then do this...];

       }

In if condition here, I need Field value which I am not able to extract.

If there is any better way, please suggest.

Hi, you can write something like this:

 

// Get the current ticket state

  var ticketState = g_form.getValue('state');

  if (ticketState === 'in_progress') {

    alert('The ticket is currently in progress.');

  } else 

    alert('The ticket is not in progress.');

  }

Edxavier Robert
Mega Sage

Hi,

 

You can do something like this on a client script: 

 

var State = g_form.getValue('state');

var stateLabel = g_form.getOption('state', State).text;

alert(stateLabel);