calculate count based on ui button

Rama26
Tera Contributor

Hi,

I have a button in requested item and also i created 2 variables in RITM table.

1) Button - checkbox

2) Button Count - Single line text. initially those 2 fields are read-only. once user click on resubmit button, automatically checkbox made true and count is 1 if it clicks 2nd time count is 2. 

How can i resolve this requirement.

written below script but it's not working

1 ACCEPTED SOLUTION

Hi Rambabu,

It is best to create resubmit count field as integer. But if you already created this and it is in prod, and if you are modifying this now, then you may use below way to sort out your issue.


If you are doing other validations on client side before resubmit action transfers control to server and if you want to execute client side script and server side script in one UI action, you can use something like below. [Below screenshot is an example you need to modify it as per your need.]

Since action name is not visible in your screenshot, I have given an action name. You may want to modify it as per your case.


find_real_file.png

If client check box is checked, then only you can execute client side logic and server side logic in one UI action.

updateResubmitCount() function execute on client side. 
In the onClick field you should do a function call using (). Just giving function name is not sufficient.

And since this is a client side code, you should check client check box on UI action to true.

And once gsftSubmit() function call gets invoked the form will be submitted to server-side (After executing onsubmit client scripts if any and if all of them return true) and then on server-side, the code written in setRedirect will execute.
You may write additional server-side code in here before current.update()

 

Thanks and regards,

Subrahmanyam Satti

View solution in original post

5 REPLIES 5

Filipe Cruz
Kilo Sage
Kilo Sage
Hello! Why aren't you creating the resubmit count field as integer, instead of string? How are you triggering this client script? Is this an ui action?

i written the script in ui action and also i have other requirement. once i click on button checkbox modify as true also

Hi Rambabu,

It is best to create resubmit count field as integer. But if you already created this and it is in prod, and if you are modifying this now, then you may use below way to sort out your issue.


If you are doing other validations on client side before resubmit action transfers control to server and if you want to execute client side script and server side script in one UI action, you can use something like below. [Below screenshot is an example you need to modify it as per your need.]

Since action name is not visible in your screenshot, I have given an action name. You may want to modify it as per your case.


find_real_file.png

If client check box is checked, then only you can execute client side logic and server side logic in one UI action.

updateResubmitCount() function execute on client side. 
In the onClick field you should do a function call using (). Just giving function name is not sufficient.

And since this is a client side code, you should check client check box on UI action to true.

And once gsftSubmit() function call gets invoked the form will be submitted to server-side (After executing onsubmit client scripts if any and if all of them return true) and then on server-side, the code written in setRedirect will execute.
You may write additional server-side code in here before current.update()

 

Thanks and regards,

Subrahmanyam Satti

Hi Subrahmanyam Satti,

Now it's working i missed action name.

Thanks