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

Question

Question

Build Weblink URL from entry id variable passed to form from workflow

asked on May 15, 2015 Show version history

I am passing the ENTRY ID of a document in the repository as a variable in the URL to start a new form via a link in an email send by workflow. I would like to build a weblink hyperlink to that item, on the form, so that users can view the document while the are completing the form. I am using the custom HTML field inserting the  {/dataset/field_name} for the variable but it will not display when the form is executed.  I know the passing of the variable data via the startup URL  is working, because it does display in the single line version of field on the form.

Any suggestions on how to do this would be appreciated.

 

1 0

Replies

replied on May 15, 2015

Ken,

 

What good timing, I just did a similar thing myself. I'm building the url but using it to update an iFrame, you can modify this same code to only update the custom HTML section using jquery.

 

For editing the custom HTML use this code instead as the tokens within Forms will not work how you want within HTML tags.

 

This is my iframe code:

<iframe width="100%" height="1000" id="docframe" src="http://rochsvr139/weblink/docview.aspx?dbid=0&amp;id=tobereplaced"></iframe>

And my JavaScript:

  function loadIframe(iframeName, url) {
    var $iframe = $('#' + iframeName);
    if ( $iframe.length ) {
        $iframe.attr('src',url);   
        return false;
    }
    return true;
}

$(document).ready(function(){
  var base_url = 'http://rochsvr139/weblink/docview.aspx?dbid=0&id='
  var doc_id = $('#Field2').val();
  var doc_url = base_url + doc_id;

  loadIframe('docframe', doc_url);
  
});

Field2 is where I'm storing the entryID I wish to display in the custom HTML.

 

When the page loads, it will find that value, build the url, and update your iframe. Note it's referencing the iframe by ID set in the custom HTML.

 

Let me know if you have an issue adopting to your needs.

 

Cheers,

Carl

2 0
replied on May 15, 2015

Hi Carl,

Thanks for the quick reply. I started by trying your code as is, just changing the base_url to Yahoo.com and the iframe appears but nothings in it? Any suggestions?

 

Ken

1 0
replied on May 15, 2015

Hi Carl,

 

You were right. It does work with NY Times! Now I have to try and edit it to work with the custom HTML to display as a URL... I might have a few more questions, if you don't mind.

 

Ken

1 0
replied on May 15, 2015

Not a problem :)

 

Here's some helpful information I used above:

 

Custom Weblink URLs follow this syntax - https://support.laserfiche.com/KB/1001086

 

Above, I'm counting on the value set in my second field on the form, to be passed via url. When the page finishes loading, it will then run the javascript to take that value and update the source destination of the iframe so I ultimately get a url which has the specific entryID I need to make a valid WebLink URL request.

 

 

 

1 0
replied on May 18, 2015

Carl,

 

I'm trying to use a modified version of your code along with a DIV class definition to create the link on the form but yet I can't get any of the link to display and it's because of the statement where I am trying to append the text after the DIV:

base_url.insertAfter(divDist);

 

Here's what I'm putting in the custom HTML:

<div id="weblink">test</div>

And here's my script:

$(document).ready(function(){
  var divDist = $('#weblink');
  var base_url = 'http://10.100.1.66/WebLink8/DocView.aspx?id=1256738';
  var doc_id = $('#Entry_ID').val();
  var doc_url = base_url + doc_id;
 
  base_url.insertAfter(divDist);
 
 
  divDist.remove();
 
  });

 

If I comment out the insertAfter line, the DIV is removed, but otherwise the script stops.

 

Any suggestions?

 

Thanks,

 

Ken 

1 0
replied on May 15, 2015

Hi Ken,

 

Does it work with http://nytimes.com instead?

 

Not all sites are iframeable but nytimes is.

 

Cheers,

Carl

 

 

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

Sign in to reply to this post.