Update Hyperlink URL in ScriptTask

Hi,

is it possible to update Hyperlink URL in ScriptTask(groovy)?

Thanks

Yeah. It is a variable of instance like the others.

Hi,

what you mean like the others?

I’m getting and setting with execution.getVariable/setVariable.

I have a simple form with one field:
{"id":"97aeaed2-5cd0-11e7-b57d-000c2911746d","name":"TestForm","key":"TestForm","description":"","version":1,"lastUpdatedBy":"admin","lastUpdated":"2017-07-03T23:04:58.356+0000","formDefinition":{"name":"TestForm","key":"TestForm","version":0,"fields":[{"fieldType":"FormField","id":"linkfield","name":"linkfield","type":"hyperlink","value":null,"required":false,"readOnly":false,"overrideId":false,"placeholder":null,"params":{"hyperlinkUrl":"http://www.flowable.org"},"layout":null}],"outcomes":[]}}

Created simple process with that form, next script task with code:
if (true) {
this.binding.variables.each {k,v -> println “$k = $v”}
}

result:
initiator = admin
linkfield = null

expected result(something like):
initiator = admin
linkfield.hyperlinkUrl = http://www.flowable.org

Hi,

The link url is a readonly field, so no value is stored as a process variable. The url will be rendered as configured in the Form JSON. We could make it more dynamic by allowing expressions to be used in the hyperlink field so you could use variables to render the hyperlink. But the hyperlink value itself is not stored as a process variable, because it’s a readonly field.

Best regards,

Tijs

Hello,
it would be great, if we can have it as process variable.

We are creating data externally and creating WF in flowable task app.
And I will need to show backlink from flowable.

Or can I use html in expression field to create link?

Hi,

Ok, could you explain in a bit more detail why you would need a process variable for a hyperlink field? I don’t understand why a process variable would be needed.

Best regards,

Tijs

Hello,

External application:

  • Document created
  • Data inserted

Start new process in Flowable:

  • Stored ID from external application
  • In Task form I want to have computed link to external application based on field from form in first user task (config_var.exthost+“path/to/somewhere/”+ExternalID)
  • update status in external application

br

Hi,

Ok I understand the use case, but that only requires one or more process variables to be used in the hyperlink url configuration right? So a bit similar to an expression field.
The hyperlink url value itself doesn’t have to be exposed as a new process variable.
Is that correct?

Best regards,

Tijs

1 Like

Hello,

exactly. Hyperlinked expression field.

br

Hi, we have a similar use case, we can generate a link for an entity in our application and want that the form view (that is about the entity) reference the entity related. This can be done if support for expressions is added to hyperlink field.
Is there any plan to support this?
Can an enhancement issue be created for this ?
Regards and thanks in advance