I am modifiyng exisiting code which currently does

```
currentDocument.setValue("field", requestScope.variable);

```

This works well, but I now need to make it a little more dynamic so, I have the `requestScope.variable` stored as a string. I know I can do:

```
requestScope["variable"]

```

but this relies on me knowing which scope it is in. Given that the string could be `requestScope.variable` or even `applicationScope.variable` I think this route is closed to me. 

I had also thought of splitting the string based on the . but think that there must be a more straightforward option.

How can I go about doing this?