Opening URL for PDF files

Annette Kitzmil
Tera Guru

Hello,

I relativley new and need some direction on how I would get a pdf document being retrieved from a different system via a url to open the specific form related to the record.  Below is code I attached to a UI action button.  However, I see there are various ways to do this and I am just not sure what the best option is for opening the PDF form.  Does the code look right and/or, is there a better option to accomplish this?

 

var gsRecord;
var url = 'https://fn5digdev.mtb.com/navigator';
var desktop = 'BDA&';
var repository = 'Retail&';
var documentCME_ID = current.u_filenet_document_id;
var templateName = 'dcRetail&';
var version = 'release&';
var embedded = true;

function openURL() {
{

gsRecord = ('url' + 'desktop' + 'respository' + 'documentCME_ID' + 'templateName' + 'version' + 'embedded');

action.setRedirectURL(url);

}

}

1 ACCEPTED SOLUTION

Annette Kitzmil
Tera Guru

Hi @Harsh Vardhan  - I found that and tried what you attached for the regex for removal of the curly brackets and the curly brackets were not removed.  However, I may no longer need them removed, so I believe I am all set and appreciate all of the help.  

View solution in original post

17 REPLIES 17

Hi @Annette Kitzmil  

 

Try using below script.

 

function onClick(g_form) {
 
    var documentCME_ID = g_form.getValue('u_filenet_document_id');
    var url = 'https://fn5digdev.mtb.com/navigator/bookmark.jsp?desktop=BDA&repositoryId=Retail&docid=%7b' + documentCME_ID + 'template_name=dcRetail&version=released&embedded=true';
 
    //https://fn5digdev.mtb.com/navigator/bookmark.jsp?desktop=BDA&repositoryId=Retail&docid=%7b18488797-B...';
 
open(url);
}

 

Working example.

 

function onClick(g_form) {

	open('https://www.google.com/');

}

@Annette Kitzmil  Also set "Client" checkbox true on your UI Action

Hi @Harsh Vardhan - So I added the script below to the workspace section of my UI Action and changed the Client Script checkbox to true.

AnnetteKitzmil_0-1692797355688.png

Then I added the other script to the Client Script and now when I click the Open Document button, it doesn't do anything.  If I remove the check for the Client Script it reverts back to the previous behavior and just reloads the old page instead of the pdf attachment.  I am hoping that I made the updates correctly which is why I am letting you know what I did.  I appreciate the help you have given me so far.

 

Hi @Annette Kitzmil  : I would suggest try with simple script to check if it open in new window.  i tested at my end with below script and it worked. 

 

function onClick(g_form) {

	open('https://www.google.com/');

}

 

If this script worked and redirect to google page then try with your script by hardcoding the url to see if it works or not? 

 

This way you can troubleshoot this. 

If possible please share screenshot of latest configuration you made on UI Action.

 

Thanks,

Harsh

 

 

Hi @Harsh Vardhan - So am I just adding the above script to the UI Action which also matches what I have on the Client Script to troubleshoot this?