Hi Sebastian Alonsoabout
Kindly download and import this sample app into your Joget Workflow, will work in both community and enterprise version 5+.
The app has a form with example JS to substring the '#currentUser.username#' and '#date.EEEE, d MMMM yyyy' into 2 text field element. Works the same concept for form hash variable. Will also work on hidden fields too.
The JS/Jquery code in the form sits in the CustomHTML field element, as follows:
<script>
$(document).ready( function(){
var uName = '#currentUser.username#';
var subUname = uName.substring(2, 5);
$('#subUsername').val(subUname);
var uDate = '#date.EEEE, d MMMM yyyy#';
var subUdate = uDate.substring(16, 20);
$('#subDate').val(subUdate);
});
</script>
You can also use substring hash in beanshell using the Java syntax.
APP_substrhash-sample-app.jwa