How to Add Action on button


i create on form and on text field 'cmnt'

I want to add a comment with a data from a form field 'cmnt' , I can add an action to the form and write the next groovy code:

apiAccessor.getProcessAPI().addComment(rootProcessInstanceId, field_TextField1);

for that i done following . now in submit's button's > general tab > action > add action now there is two field

---- takes value of ----- now exactly where i have to write code ?

i tried by ---- takes value of -Code = give error Variable -- takes value of -- Code = give error

what mistake i m doing

Thanks in advance


Submitted by ttoine on Tue, 04/15/2014 - 15:38

did you try to clic on the small pen icon on the right of the field ? it opens a window, and you can choose different of value (constant, script, ...)

Submitted by kppatel on Tue, 04/15/2014 - 15:50

Ya i know where to write script But There are two field in button > action

  1. Field not allow to write script it just allow variable

(Takes value of )

  1. Field where i wrote actully script

But it can't run without 1st field fill So i create one var and put into first field Then try to run process After click on submit It prompt "error while submit form"

Submitted by ttoine on Tue, 04/15/2014 - 15:54

what does your scprit return ? the aim of the action is to return something in the variable you set in the first field...

Submitted by kppatel on Tue, 04/15/2014 - 16:01

Yup that is My script is not return anything It will just add comment of forms field into dashbord's commnet So how can i achive that

1 how can i add action without return anything As per above script Or I have to return anythin dummy and save to variable?

Submitted by kppatel on Wed, 04/16/2014 - 07:30

Thank You so so so much , It works perfectly fine Thanks again

1 answer

This one is the BEST answer!

create a boolean variable, and return true or false, something like that.