cancel
Showing results for 
Search instead for 
Did you mean: 

Ho to show/hide buttons and table controllers based on conditions set in the groovy script?

debtechno
Discoverer
0 Kudos

I'm using the following code in my groovy script to hide or show a button and a table controller in the form. But this is not working and not making any difference in the show/hide of the screen elements. This script is called on a button click in SAP advanced workflow form.

form.getButton(<button_name>).hide()

form.getWidget(<table_controller_name>).hide()

and

form.getButton(<button_name>).show()

form.getWidget(<table_controller_name>).show()

If someone can hep me in finding where I'm missing something then it will be greatly appreciated.

View Entire Topic
Lana
Advisor
Advisor
0 Kudos

Hi,

In SAP Advanced Workflow, names of objects are used on screen, to see which object is, in a nice, human readable way. But when you reference some object in the script, you need to reference it with its system id, not with its name. In Form Designer, there is field 'System id' , and when you add an element, you need to enter a value for the System ID there if you want to access that element from your scripts.

If you want to hide one element try:

form.getField('my_cystom_field_system_id').hide();
form.getButton('my_button_system_id').hide();

If you wish to hide several fields, or entire reusable form, you can put them all inside a Section element in the Form Designer, and then hide that section, like this:

def section = form.getWidget('section_system_id');
section.hide();

The script which is doing show/hide things needs to be a 'Form Event' script, and it needs to be attached on appropriate Event on your action.

If you have further questions, or need additional explanations on something, feel free to ask.

Best regards

Lana

(Product Owner of SAP Advanced Workflow)

Display_Name
Explorer
0 Kudos

Hello,

On the same context, how to hide 'add', 'delete' and 'Select All'  buttons on specific conditions on the Table Controller  (form.getTableController) using the groovy code?

Thank you

Lana
Advisor
Advisor

Hi Kashvi_Anaisha,

Unfortunately we don't have scripting methods to show/hide 'Add', 'Delete' and 'Select All' on Table Controllers.

These options can be either always turned on or off on entire Table Controller (in Setup->Fields and Forms -> Custom Fields , then find desired Table Controller, click Edit, then click Customise Table Controller)

Best regards

Lana

Display_Name
Explorer
0 Kudos

thank you @Lana