Perfect. That's it!
And meanwhile I also understand your aproach by rule conversion. I will do the same.
Original Message:
Sent: 08-12-2024 03:53
From: Shayan Amini
Subject: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()
Hi,
SVFormDoSetActionsAndSubmit(0,'TODO_ButtonId'); //Complete
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId'); //Approve
SVFormDoSetActionsAndSubmit(3,'TODO_ButtonId'); //Reject
SVFormDoSetActionsAndSubmit(4,'TODO_ButtonId'); //Save
SVFormDoSetActionsAndSubmit(5,'TODO_ButtonId'); //Save & Route
------------------------------
Shayan Amini
Material Master Data
------------------------------
Original Message:
Sent: 08-12-2024 03:46
From: Norbert Prumbs
Subject: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()
Thanks Amini for your reply. Unfortunately it does not meet my question exactly.
I am interested in possible values to the parameters of this function:
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId'); //Approve
SVFormDoSetActionsAndSubmit(?,'TODO_ButtonId'); //?
as well:
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId'); //Button behavior
SVFormDoSetActionsAndSubmit(2,'?'); //?
------------------------------
Norbert
Original Message:
Sent: 08-12-2024 03:26
From: Shayan Amini
Subject: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()
Hi Norbert,
In our solutions we usually build a function that will carry out all the JS Code we wish to execute during submit.
And lastly we add the "SVFormDoSetActionsAndSubmit".
Example:
Function submitRequest() {
[Insert Function1] --> Function could potentially populate data in some table.
[Insert Function2] --> Function could potentially perform some validation
if Function2 returns error then return and show pop-up message to user
Else
SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId'); //Approve
}
In the end we when add a "Button" on the form we add the function "submitRequest()" to be executed when button is clicked and it will carry out everything that is inside that function.
If you need to figure out which parameter to provide to "SVFormDoSetActionsAndSubmit" i suggest you add a standard rule and thereafter convert it to JavaScript.

Not sure if this answers your question or whether this is best practice but this is usually how I handle it.
------------------------------
Shayan Amini
Material Master Data