Jelly While Tag - how we can set a Value for a Button and use it in the Clientscript

Meloper
Kilo Sage

If i use this:

<g:evaluate var="jvar_myvar" jelly="true" object="true">

var inc = new GlideRecord('incident');
inc.setLimit('5');
inc.addQuery('active' , 'true');
inc.query();

inc;
</g:evaluate>


<j:while test="${jvar_myvar.next()}">
<button>${jvar_myvar.getValue('number')}</button>
</j:while>

i am able to create a Button for each GlideRecord Element.

Now i need a Solution to give that Buttons a Value and use this Value in the CS.

 

For Example:

I have 5 Buttons with there Incident Numbers.

Each Numbers should also be the Value of each Button

And if i click on one of these Button, the Value should be written in a Field on the Incident Form.

 

find_real_file.png
Without the Value, the Button appears with the Groupname (its another example)

1 ACCEPTED SOLUTION

I think the issue may be elsewhere... Let me take a jab now.

Replace your button code with this:

<button type="button" onclick="updateField('${jvar_group_buttons.getValue('sys_id')}')">${jvar_group_buttons.getDisplayValue('group')}</button>

 

The assignment group is a reference field and only loves sysid.

 

Edit : ADDED THE TYPE ATTRIBUTE TO THE BUTTON and changed value to sys id

 

This should work!

View solution in original post

9 REPLIES 9

Clientside UI Action

find_real_file.png

 

If i click on the Button on the Form it appears one Button we created with the while loop

find_real_file.png

After i click on the Button the Text "Expertise Test" appears in the Field

 

After that the form reload? an it shows like that:

 

find_real_file.png

So it seems to be, that after i click on the new Button, the UI Page replace the form and shows only the Button.

The INC Form is not visible

I think the issue may be elsewhere... Let me take a jab now.

Replace your button code with this:

<button type="button" onclick="updateField('${jvar_group_buttons.getValue('sys_id')}')">${jvar_group_buttons.getDisplayValue('group')}</button>

 

The assignment group is a reference field and only loves sysid.

 

Edit : ADDED THE TYPE ATTRIBUTE TO THE BUTTON and changed value to sys id

 

This should work!

The cause was the button type.
Thank you, sometimes it's that simple. 
I used the ability to pass values ​​through functions 20 times a day. But as soon as you have something to do with something else (jelly)
you can no longer get down to the basics and think too complicated.

lol yeah 😄