Get tenant name in before provisioning rule

Is there any way to get the current tenant/instance name in a before provisioning rule?

We have a BP rule with environment specific variables that requires SP ES to upload to each environment individually every time.

e.g. if tenant instance name contains dev

set variable for dev

if tenant instance name contains qa

set variable for qa

It would be more efficient if it can be uploaded to the SB instance by SP ES once and then migrated to other tenant instances using the SP-Config API.

Hi Rishabh,

I’m not sure if this is possible, but I generally wouldn’t recommend this approach anyway, since you’d need to hard code all the different variables in your rule based on the environments.

What we do is store these attribute in the source configuration itself using the /sources API:

{
  ...
  "connectorAttributes": {
    "variable1": "foo",
    "variable2": "bar",
  ...
  }
}

And reference those values via:

application.getAttributeValue("variable1");
application.getAttributeValue("variable2");

That way we can not only re-use the same rule between environments but even in many cases use the same rule in different sources in the same environment.

1 Like

Thanks Ramiro this is exactly what I was after.