- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 11:09 AM
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);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 09:26 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:43 PM
Hi @Harsh Vardhan - So I am pretty close with the script below with the exception of the removal of the {} that are around the document ID. The commented out url is an example that I can now generate, but it is failing because I need to find away to remove the brackets that are part of the string for the document ID. Do you know how I can accomplish this?
function onClick(g_form) {
var documentCME_ID = g_form.getValue('filenet_document_id');
//g_form.addInfoMessage(documentCME_ID);
var url = 'https://fn5digdev.mtb.com/navigator/bookmark.jsp?desktop=BDA&repositoryId=Retail&docid=%7b' + documentCME_ID + '%7dtemplate_name=dcRetail&version=released&embedded=true';
g_form.addInfoMessage(url);
top.window.open(url, '_blank');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 07:32 AM
Hi @Annette Kitzmil : You can try with regex to remove certain char from string.
Updated Script:
function onClick(g_form) {
var documentCME_ID = g_form.getValue('filenet_document_id');
var regex = /\{|\}/g;
var newText = documentCME_ID.replace(regex, '');
var url = 'https://fn5digdev.mtb.com/navigator/bookmark.jsp?desktop=BDA&repositoryId=Retail&docid=%7b' +newText+ '%7dtemplate_name=dcRetail&version=released&embedded=true';
g_form.addInfoMessage(url);
top.window.open(url, '_blank');
}
Hope it will help you.
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 09:26 AM
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.
