Forum

 View Only
  • 1.  [Serviceaide Automation] How to set variables using scripts?

    Posted 10-11-2022 11:41

    Hi,

    I want to use a Groovy scripts to set variables and use then in another step of my process.

    Anyone knows how can I make it?

    That i`m trying to do:

    • Create a scripttask called current date
    • Use a Groovy script to set 2 variables: currentDate and LastWeekStartDate
    • Configure a REST API and try to use this 2 variables during the call
    Thanks!

    ------------------------------
    Ricardo Andrade
    Field Consultant
    ServiceAide
    ricardo.andrade@serviceaide.com
    ------------------------------


  • 2.  RE: [Serviceaide Automation] How to set variables using scripts?

    Posted 10-14-2022 10:31

    Hi Ricardo,

    Here is an example of how Script task can be used.

    The below sample script uses Workflow variable 'Counter' and workflow input parameter 'sam_account_name' and sets another workflow input parameter 'SAM account'. 

    def var
    String b
    String account

    b = execution.getVariable("wf_var_Counter".toString())
    account = execution.getVariable("wf_in_sam_account_name")
    account = account.concat(b);

    execution.setVariable("wf_var_SAMAccount", account)

     

    Hope this helps.



    ------------------------------
    Sneha Tripathi
    Serviceaide
    ------------------------------