Automate

 View Only
  • 1.  EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()

    Posted 08-09-2024 05:44

    I must customize button behavior more specific by javascript (js) code. Beside other coding, also standard button behavior (save, save submit, exit, etc.) should be carried out by the js code. I know js function SVFormDoSetActionsAndSubmit(), but can't find any source about how to setup its parameter.

    Just known is that SVFormDoSetActionsAndSubmit(2,'TODO_ButtonId') effects a save and submit.

    To avoid try&error, I would appreciate your information on the possible parameters. Thanks in advance.



    ------------------------------
    Norbert
    ------------------------------


  • 2.  RE: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()

    Posted 08-12-2024 03:26
    Edited by Shayan Amini 08-12-2024 03:34

    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
    ------------------------------



  • 3.  RE: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()

    Posted 08-12-2024 03:47

    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
    ------------------------------



  • 4.  RE: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()
    Best Answer

    Posted 08-12-2024 03:53

    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
    ------------------------------



  • 5.  RE: EVOLVE Form: How to customize button behavior by SVFormDoSetActionsAndSubmit()

    Posted 08-12-2024 04:17

    Perfect. That's it!

    And meanwhile I also understand your aproach by rule conversion. I will do the same.

    Best regards



    ------------------------------
    Norbert
    ------------------------------