Servicedesk - custom action - open url of other application

Servicedesk - custom action - open url of other application

We have an additional field where we maintain the ID of a ticket in another application.
I would like to be able to have a button / menu  item  that builds the url to the other application

https://ourotherapp.example.com/Workflow/Taskdetail?id=<custom field from the request>

and then opens that url in a new window.

I think I've been able to script this in a custom function:

returnjson = Map();
appid = requestObj.get("udf_fields").get("udf_sline_5101");
if "null".equalsIgnoreCase(sotid) {
returnjson = {
"result": "success",
"message": "No App ID."
};
}
else {
  offset = 999 ;
  appinternalid = appid.toNumber() + offset;
  openurl(url,"new window");
  messagestr="App ID:".concat(appinternalid);
returnjson = {
"result": "success",
"message": messagestr
};
 }
return returnjson;


But now I'm stuck. How do I make this custom function available in the interface, for the end-user to execute if he/she wants.
This is an ad-hoc action, not part of any workflow. It just eliminates the user of opening the other application and manually searching for the correct task.

                  New to ADSelfService Plus?