1
0
-1

we have the following definition of a job action in a job controller json definition:


{
"name": "Send Notification Email",
"type": "Job Action",
"properties": [
{ "name": "EmployeeType", "value": "Internal" },
{ "name": "EmailType", "value": "WelcomeEmployee" }
]
}

Send Notification Email is a Fluent Job Action.

How do we get the values of the EmployeeType and EmailType properties in the groovy script?

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi,

      Take a look at ActionStepProperties 

      You should be able use the constructor ActionStepProperties(ActionContext actionContext) to get an ActionStepProperties object, then call ActionStepProperties#getProperty-java.lang.String-  or ActionStepProperties#getProperty-java.lang.String-java.util.Map- on it.

      Use the Map variant of getProperty if you have $ substitutes in the property values, as it will perform the substitutions for you.

      1. Miroslav Botka

        Hi Bill, will this work in Fluent? Both ActionStepProperties constructors require the ActionContext object provided. How do we get the current ActionContext object in a FluentJobActionService?

      2. Miroslav Botka

        just tried a quick test but got

        Importing [com.avoka.fc.core.service.job.impl.ActionStepProperties] is not allowed

        immediatelly

      3. Bill Frost

        You might need to use a non-Fluent service to access the parameters and invoke it from your own service using GroovyServiceInvoker.  If you create a Groovy Job Action service, actionStepProperties is one of the supplied parameters.

        Alternatively (or additionally), you could log a request to make ActionStepProperties available via Fluent.

      CommentAdd your comment...