Fetch current record number in UI action script

Piyush Pramani1
Tera Contributor

Hello There,

I want to fetch the value of the ("number") field of the current record when I click a UI action button in a table.

Can anyone give me a demo code?

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

hello @Piyush Pramanick ,

you can just use  current.number in UI action script 

gs.addInfoMessage(current.number);

PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU

View solution in original post

3 REPLIES 3

Mohith Devatte
Tera Sage
Tera Sage

hello @Piyush Pramanick ,

you can just use  current.number in UI action script 

gs.addInfoMessage(current.number);

PLEASE MARK MY ANSWER CORRECT IF IT HELPS YOU

Sagar Pagar
Tera Patron

Hi,

Try this in onclick function script-

 

onclick function - showNumber();  


function showNumber(){

alert("numnber: " + current.number);


}

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

what's your script?

If you share that we can provide better suggestions

If your UI action is

1) Client side then

g_form.getValue('number')

2) Server side then

current.getValue('number')

Regards
Ankur

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