This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 9, 2013, 11:09 PM
453 Posts
topic has been resolvedResolved

Calling a function in a JS Library

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags: SSJS
  • Replies: 2

I have created a JavaScript Library and written a function in it to load some values from one document to another.

function loadTrans(tDoc:NotesDocument , pDoc:NotesDocument){
    tDoc.replaceItemValue("Form","frmACTrans");
    tDoc.replaceItemValue("LinkKey",pDoc.getItemValueString("LinkKey"));
    tDoc.replaceItemValue("ACProfileName",pDoc.getItemValueString("ACProfileName"));
   .


    return

I have added the Library as a resource to a Custom control and on that control I have a button. Now  from the on click event on the button I want to call the function LoadTrans

I have both tDoc ans pDoc defined in the on Click event but what is the syntax to call the function. Do I have to make the Library a resource for the button as well?

Thanks

 

Jul 10, 2013, 7:30 AM
15 Posts
Like calling any javascript function...

If tDoc and pDoc are declared somewhere and have been assigned values, then you call the function with this line:

loadTrans(tDoc,pDoc);

You don't need the script library as a resource on the button. It only needs to be included in the custom control.

Also, outside the function, the two document variables don't need the same name as they have inside the function. You could define them in the button with different names. E.g. If they're declared outside the function as document1 and document2, then the function call would be:

loadTrans(document1,document2);

Jul 10, 2013, 3:13 PM
453 Posts
Thanks

I had included the declaration part in the call loadTrans(tDoc:NotesDocument, pDoc:NotesDocuemnt) which cause problems.

I understand that they do not need the same name in the function as in the declaration I just did it that way because

Thanks again


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal