cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
awu09
Nintex Newbie

Configuring a button action with Javascript

Jump to solution

Hi all,

 

I am quite new to Nintex and have a question regarding a Javascript action that should be executed when a certain button in my Nintex Form has been clicked.The goal of the Javascript action is to start a child workflow that terminates the main workflow which is running on the current item.

 

I tried looking for solutions in the community, but as I have never used Javascript I do not understand any of the scripts and I would not even now where to insert them.

 

What I tried to do now is to create a single line of text column called "Terminate WF?" with the default value "No". As my child workflow will start once this column contains the string "Yes", I just need the button to turn the "No" into a "Yes" when it is clicked.  I tried configuring this with the control settings of the button:2019-06-28 10_08_18-Nintex Forms Designer - PreReleaseRequests - dsPreReleaseRequest.png

This was just my first try, I assume that putting the same commands in "Client Click" and "Value Returned" won't work, but I also have trouble to understand what these Actions would do in my specific case. All the button does right now is refreshing the page when it is clicked.

 

Is there anyone who could help me with this?

 

Thank you,

Alexander

Labels: (2)
0 Kudos
Reply
4 Replies
Automation Master
Automation Master

Re: Configuring a button action with Javascript

Jump to solution

Hi Alexander,

 

if you only need your "Terminate WF?" column to say "No" on button click i think you can empty the "Client click" field and simply enter "Yes" inside the "Value returned" field of your button settings. Depending on the type of your "Terminate WF?" column you may have to enter another value as "Yes" might not work for a yes/no field (not sure about that). You could try to enter true or 1 instead.

 

Cheers

Philipp

 

 

Reply
awu09
Nintex Newbie

Re: Configuring a button action with Javascript

Jump to solution

Hi Philipp,

 

thank you for your answer. Unfortunately, when I empty the "Client click" field I get the following warning message: The "Client click" property is required when "Button action" is "JavaScript".

So filling this field seems to be mandatory.

 

What exactly is the difference between these fields? I thought the client click field would simply replace the button action and executes a customized action instead. But then the "Value returned" field would be reduntant if I simply want to change the value of a column with my customized button action.

 

Best regards,

Alexander

0 Kudos
Reply
Automation Master
Automation Master

Re: Configuring a button action with Javascript

Jump to solution

Hi Alexander,

 

you are right. If all your js function does is setting this field value, both settings would be the exact same thing. Does your js function do anything else? Otherwise just change the button action back from javascript to save and submit and use the other setting to set your field. Try to avoid js as good as you can as it makes your form more complex and therefore harder to understand/maintain.

 

 

View solution in original post

Reply
awu09
Nintex Newbie

Re: Configuring a button action with Javascript

Jump to solution

Hi Philipp,

 

changing the button action to save and submit is indeed the solution. I did not know that you are also able to configure the button action if you select one of the pre-defined actions from Nintex. But you are right, this is a quite simple solution without having to use js Smiley Happy

 

Thank you!

0 Kudos
Reply