Conditional Variables - Need a function to return an ID

Hey,

I’m doing this:

val baseUrl = System.getProperty(“TARGET_BASE_URL”)
.get("/api/v1/assignees/2326/clients")

So based on the target environment, the ID 2326 will change to say 10 or 1000.

I’d like to create a function that returns the ID, and assign this to a variable.

Can someone provide an example on doing this in Gatling, please? The function logic is something like this.

function getSomeId(baseUrl) {
if(baseUrl contains striing “preprod”) {
return 2326
else if(baseUrl contains “feature” || baseUrl contains “localhost”) {
return 10
}
}

.get(“api/v1/assignees” + getSomeId(baseUrl) + “/clients”)

Many thanks,
Paul