You are viewing limited content. For full access, please sign in.

Question

Question

Forms - use value in same row in custom HTML field

asked on August 27, 2024

Hello,

I have a form that will be invoked by a workflow. There is a table in this form, and I'm populating rows using multi-value tokens created in Workflow. Screenshot below:

The rows populate fine. What I'd like to do is use the value in the URL field in each row within the custom HTML field over there on the right in order to allow users to pull up the document that the row pertains to. However, using the standard "{/dataset/Invoices/URL}" variable from the token picker results in only the first value in that multi-value token from Workflow being put in the custom HTML, even though each individual URL field is correct.

Can I do this out of the box? I'm hoping there's some syntax that can be used that will tell Forms to use the value in the current row.

Thanks!

0 0

Answer

SELECTED ANSWER
replied on August 28, 2024

Does this work?

{/dataset/invoices/URL[Row()]}

 

I haven't used it specifically the way you are trying, but I know this kind of row reference works within a Save to Repository task, so maybe it works here too. 🤞

 

Failing that - maybe look at adapting the code I shared on this post that does something similar: https://answers.laserfiche.com/questions/221718/Clickable-URL-in-Single-Line-Field#221731

1 0
replied on August 28, 2024

That ends up resolving to the user task again somehow - not sure how that would happen but I get a new tab and it's just the same user task.

I'll take a look at that link. Thanks!

0 0
replied on August 28, 2024

I think you would need to use the browser inspector to investigate what the actual structure of the link is doing to determine why the link is behaving that way.

Since I don't know the full code you are using to create the link, I can't speculate.

The code from that linked posted is similar to what @████████suggested with the Javascript to create the links, but is structured to do it in the table.  The reason I said "adapting the code" is because the structure of the link you are creating is likely different than the structure used in that other post - but otherwise most of the code should be the same.

 

0 0
replied on August 28, 2024 • Show version history

Inspecting the link shows the following as the href: 

https://servername.domain.com/Forms/form/avsubmission?RemoveHead=true&clientHandlesRedirect=true&routingResumeId=f2b352d6-2ccc-4b18-92c4-86f6b9daede6&submissionId=&readonly=false&hideHeader=true

Not sure where that came from. Regardless, your code that you linked works great!

0 0
replied on August 29, 2024

That looks like it might have been the link for the Forms task itself.  I'd have to see the full HTML you were using to speculate what it was doing.

But if the Javascript is working for you - that may be a better solution.

0 0

Replies

replied on August 27, 2024

If you're already processing this data using a workflow, is there any reason that you can't just form the value of the HTML field using the workflow and pass that directly to the form rather than trying to generate the link in the form? That would be as simple as having a multi-value token and, for each value of your invoice entry IDs, appending a new value to the token that looks something like:

<a href="https://server/invoicelink%(entryID)">View Invoice</a>

Then you just set your business process variable of the HTML column to the multi-value token. I think that would work.

1 0
replied on August 28, 2024

Hi Kevin,

I was trying to do something like that, but I don't believe Workflow can set any values for a custom HTML field. It's not something that appears in the Invoke Business Process activity as any sort of token. I could just be missing it, though?

0 0
replied on August 28, 2024 • Show version history

I think you are correct. I realize that I've never directly set the value of an HTML field but have only set the value of a text field that I used as the value of the HTML field in Forms instead. I'm certain there is a way to use Javascript to loop through the URL column and rewrite the HTML link column, but I am not a Javascript expert. I can give you the Javascript to perform this on one field, which you may be able to use to figure out how to loop through the columns. In this example using the modern designer, the URL is contained in field ID #3 and the HTML link is contained in field ID #12.

var link= LFForm.getFieldValues({fieldId: 3});
LFForm.changeFieldSettings({fieldId: 12},{HTMLContent: '<a href="'+link+'" target="_blank">View Invoice</a>'});

I did find this post, which shows a way to loop through values in a table. This, combined with the above, should be a pretty good starting point: LFForm object subscribe to table/collection changes - Laserfiche Answers

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.