Design Studio button script for ImageNow

Sort:
You are not authorized to post a reply.
Author
Messages
jph826
Advanced Member
Posts: 28
Advanced Member
    I've been asked to add a button to a Lawson HR form that will execute ImageNow.  The sample script I have is for AP and I don't know how to change it to apply to an HR form.  Has anyone done this and if so, would you be willing to share a sample script with me? 
    We basically want it to use the Lawson # to show the associated documents.
    Here is what was in their documentation:

    1. Open Lawson Design Studio and open the Lawson Form to which you want to add a button.

    2. At the bottom of the screen, click Script and insert a script similar to the following, where Text1,

    Text7, Text8, Text12, and Text13 are the values of the name properties that you want to capture.

    function grabAllFormValues()

    {

    Company = lawForm.getFormValue("Text1", 0);

    if (Company == '')

    {

    alert("Cannot display image without a valid company value on the

    form.");

    return;

    }

    alert("Cannot display image without a valid company value on the form.");

    Vendor = lawForm.getFormValue("Text7", "0");

    if (Vendor == '')

    {

    alert("Cannot display image without a valid vendor value on the

    form.");

    return;

    }

    while (Vendor.charAt(0)==" ")

    {

    var VendorLength=Vendor.length;

    Vendor = Vendor.slice(1,VendorLength);

    }

    PO = lawForm.getFormValue("Text8", 0);

    while (PO.charAt(0)==" ")

    {

    var POLength=PO.length;

    PO = PO.slice(1,POLength);

    }

    if (PO == '')

    {

    PO="NoPO";

    }

    Invoice = lawForm.getFormValue("Text12", 0);

    Perceptive Software Integrate ImageNow with Lawson

    Page 21 of 22

    while (Invoice.charAt(0)==" ")

    {

    var InvoiceLength=Invoice.length;

    Invoice = Invoice.slice(1,InvoiceLength);

    }

    if (Invoice == '')

    {

    alert("Cannot display image without a valid invoice value on the

    form.");

    return;

    }

    Inv_Date = lawForm.getFormValue("Text13", "0");

    }

    function DisplayImageWeb()

    {

    grabAllFormValues();

    imgAddress =

    "http://lawson.imagenow.com:8100/webnow/index.jsp?action=filter";

    imgAddress = imgAddress + "&folder=" + Vendor;

    imgAddress = imgAddress + "&tab=" + Invoice;

    imgWindow=window.open(imgAddress,"invoiceWindow","location=yes,menubar=no,res

    izable=yes,scrollbars=yes,titlebar=yes,toolbar=no");

    imgWindow.focus();

    return true;

    }

    Vijay S
    Veteran Member
    Posts: 174
    Veteran Member
      Couple of years back I did it for my previous client, I did the same on HR11 for document imaging. What I remember is
      1) Open HR11 in designstudio.
      2) Add a button on it (just drag and drop functionality).
      Button functionality :-
      3) So when user fills up the company and employee you need to capture it. If the fields are left blank, put alerts so that user doesn't leave them blank (u just need to copy the code for this from sample scripts at the end of design studio user guide).
      3) on "Onclick" event (you know to go that last tab and add code for this functionality), you need to add a functionality and simply call call window.open function in java script which will call the image doc website and pass company and employee info to it (u can google, how to use window.open functionality). you too need to validate step 3 along with this code. 
      I just tried to find the exact code, seems like I never saved it. 

      Thnx,
      Vijay
      Georgette
      Veteran Member
      Posts: 52
      Veteran Member
        Vijay is correct in that when you open the HR form in Design Studio, it automatically applies the script to the current form.
        Unfortunately my ImageNow is for the GL so I don't have any HR code to give you.
        In the production environment of the HR screen, highlight the field you wish to capture to link to your attachments and hold the Control+Shift keys and the letter O. This will give you the name of the field in the status bar at the bottom of the screen which you will want to capture in your ImageNow script (i.e., PCT_EMPLOYEE for the Employee ID in the Personnel Action table).

        If your status bar does not show the value, it may be that you need to turn on this feature in the windows environment.

        In the sample script above, Company, Vendor, Invoice and PO are just variable names. They are assigned a value on the form. The very next line gives the alert if the value is blank (the two single quotes '').

        As a caution, you may have to include Company and Process Level in your capture. Some forms require this.

        If you want to capture the Employee ID, you could put EmpID = lawForm.getFormValue("Text8", 0); where the value of Text 8 could be PCT_EMPLOYEE. I can't remember if the field name PCT_EMPLOYEE should be enclosed in single quotes, double quotes or none.

        Or it could be a single value like Company usually is "0001".

        Hope this helps.

        David Britton
        Veteran Member
        Posts: 53
        Veteran Member
          I added 2 buttons to our HR11.1 and PA31.1 screens that opens a web page on a different webserver to display either Legacy employee data (sundata button) or Images (images button) related to the employee.
          The only field from either form I grab is "employee" using lawForm.getFormValue("employee")


          function BUTTON_OnClick(id, row)
          {
          if (id == "sundata") {
          var employee = lawForm.getFormValue("employee");
          var URL = "http:///univbrowse/databrowse.asp?System=HRS&RptName=HISTEMPINFO&P1=" + employee;
          window.open(URL, "", "");
          }


          if (id == "images") {
          var URL;
          var employee = lawForm.getFormValue("employee");
          var employee_nm = lawForm.getFormValue("out2");
          if (employee != "" && employee_nm != "" ) {
          URL = "http:///DB/HPDataBrowsePage.jsp?System=IS&RptName=IMAGES&Submit=Y&IGN=EMP&GK=" + employee ;
          window.open(URL, "", "");
          } else if (employee == "" ){
          alert("APPLICANT number is required.");
          }
          else if (employee_nm == "" ){
          alert("Valid APPLICANT number is required.");
          }
          }

          return true;
          }
          You are not authorized to post a reply.