Based on the comments you added, I believe you are trying to do something that is impossible.
A computed for display field is computed on the server, before the page data is sent to the browser.
The onload event script is executed in the browser, after the page data has been fully sent and loaded.
Since your formula `test := @GetField("Role"); executes in a computed for display field, it is clear that the onload script that sets the Role field's value has not executed yet, therefore it is correctly returning blank.