0

I was able to write a simple PBCS Groovy Business Rule to launch a PBCS non-Groovy Business Rule that didn't require any parameters. Now I have a requirement to pass run-time prompt member values (a user in an action menu will define some key members to pass to the Groovy script that does other things for automation purposes other than just launch this business rule) to the business rule.

THe concern here is that

  1. I am not sure by passing the RTP values to the invoked business rule that they will not only pass and be inherited by the rule (do I just reference the same RTPs in the business rule that existed in the Groovy script that fed these RTP members?) but

  2. How will I ensure the variables are inherited and won't prompt the user again to specify the same RTP members? I know you can turn off the RTP prompt and just maintain the previous value - but this is a setting at the Variable level itself and won't be good as it would require an admin to switch this setting off/on whenever the end user runs the Groovy script again via an action menu since that part requires a prompt even if the 2nd part would't.

  3. It sounds like I would have to find a way to pass RTP values to a subvar of some sort and then reference the subvars in the invoked business rule?

This seems tricky since this is Cloud - not on-premise where I can use trickery via MaxL and XML files to pass values.

smomotiu
  • 39
  • 6

1 Answers1

0

You can retrieve RTP in groovy business rule and set substitution variable with the same value, that can be used in other non groovy business rules. Please refer the below code for changing substitution variable.

Connection connection = connection("URL/rest/v3/applications/", "DOMAIN.EMAIL", "PASSWORD");
//HttpResponse response = connection.get().asString();

String body ="""{
"items": [{
"name": "SUBVAR",
"value": "FY19",
"planType": "Plan"
}]
}"""
HttpResponse response = connection.post("/APPLICATIONNAME/substitutionvariables")
.header("content-type","application/json")
.body(body).asString()
println response.status
println response.body
println response.statusText

Note: Update URL, DOMAIN, EMAIL, PASSWORD, APPLICATIONNAME and SUBVAR before executing.