I want increase variable value , +1 after click on button

Actually ,

i have modify button on my system : leave approval application .
i want to track how much type loop go through : means how much tym user modify request

for that i want to add action on modify leave button : which just increase value of variable by +1 when button clicked .

pl provide me specific script for it
if possible

Couple of ways to achieve this .

  1. Using Actions on button
    Add an action with your variable name modifyCount
    For Takes value of create a groovy script with value as
    return modifyCount + 1
  2. Use connector on the button
    Add a groovy script on click of the modify button
    Script should looks something like this replace ‘modifyCount’ with your variable name
    apiAccessor.processAPI.updateActivityDataInstance(“modifyCount”, activityInstanceId, modifyCount + 1);

Let me know if it works