How to check if user-entered field is a valid website format or not?

Hello,

I have been trying to get a simple script task written in javascript to work. I want to check if a passed in parameter is a valid url format, but it seems like when I try to use regex or “new URL(varParameter)” this fails. I’m not the most familiar with how Camunda works, but how can I achieve this?
I am currently using IFS Cloud’s workflows to create this, which uses Camunda Platform 7.

This is what my script task currently looks like, but I get an error saying it does not recognize “url”

Any and all advise would be greatly appreciated.
Thanks

Hello @BDou ,

in general, I like the approach of using the Java URL class.

In embedded js, this class has to be called explicitely:

var URL = Java.type("java.net.URL");
var validUrl = new URL("http://localhost:8080");

From: Using Java From Scripts

I hope this helps

Jonathan