Announcement

Collapse
No announcement yet.

How to conditionally load a file in the background using JavaScript

Collapse
X
Collapse
  •  

  • How to conditionally load a file in the background using JavaScript

    Following JavaScript can be used to load a file based on conditions.

    1: Save this code in a JavaScript library called JSlib (or whatever you choose just remember to change references)
    Code:
     
    function loadFileFromSchedule(schedule)
    { 
    var rteReturnValue = new SCDatum(); var rteNames = new SCDatum(); rteNames.push("record"); var rteValues = new SCDatum(); rteValues.setType(8); rteValues=system.functions.insert(rteValues, 0, 1, schedule); system.functions.rtecall("callrad",
    rteReturnValue, "bgload", //RAD app name rteNames, rteValues, false); //false to run in same thread, true to run in new thread
    return true;
    }
    2:
    Code:
    if (true)
    {
    system.library.JSlib.loadFileFromSchedule(vars["$L.schedule"]);
    }
    To use this do following:
    • Goto database manager
    • Rigth click and select Import/Load
    • Select the file to load (remember must be on a path accessible to the server)
    • Click LoadBG
    • Choose the parameters for the schedule, make sure it in future
    • Click LoadBG to make the schedule
    • Via database manager find the schedule record
    • Remove bgload from the field Application
    • In javascript paste code 2
    • Save the schedule


    NOTE: The bgload application in pre SM 7.10 has a bug that cause it not to work so if you are running SC 6.x or SM 7.0.x then you need to load the application from a 7.10 server.
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    Latest Articles

    Collapse

    • SMHTMLemail - send html formatted emails from ServiceCenter / ServiceManager
      by tommy
      With this application you will be able to

      - send nice formatted emails in both html and plain text format
      - easily add new templates
      - send emails with different from addresses
      2011-01-27, 20:25
    • Tester
      by Lukus
      Test New Article for Tommy.

      Cheers,
      Lukus
      2010-06-18, 04:39
    • Service manager 9.20 - well done hp
      by tommy
      Well done HP. In your effort to improve the webclient look and feel you managed to SCREW UP the standard client OOB forms to a point where they are useless. No customer that create more than a handfull of tickets a day will be happy to use the client because the webclient is still slow so they want to use the windows client. But the webclient does look better than the earlier versions. But the big problem is that notetabs on the OOB forms are GONE. Instead they are replaced with grou...
      2010-06-16, 18:42
    • Rules
      by tommy
      I have never really written rules down since common sense basically is all the rules that is required. However recently more and more users seem to think that posting the same question in multiple forums is a good idea. Or that it really helps them to bump a thread!

      Come on people. This is a small site, duplicate threads and bumping threads is NOT necesary.

      So here are som basic rules that you must follow in addition to use common sense:
      • Do NOT post the s
      ...
      2010-02-24, 19:06
    • How to conditionally unload a file in the background using JavaScript
      by tommy
      Following JavaScript can be used to unload a file based on conditions.

      1: Save this code in a JavaScript library called JSlib (or whatever you choose just remember to change references)
      Code:
       
      function unloadFileFromSchedule(schedule)
      { 
      var rteReturnValue = new SCDatum(); var rteNames = new SCDatum(); rteNames.push("record"); var rteValues = new SCDatum(); rteValues.setType(8); rteValues=system.functions.insert(rteValues, 0, 1, schedule); system.functions.rte
      ...
      2010-02-12, 21:28
    • How to conditionally load a file in the background using JavaScript
      by tommy
      Following JavaScript can be used to load a file based on conditions.

      1: Save this code in a JavaScript library called JSlib (or whatever you choose just remember to change references)
      Code:
       
      function loadFileFromSchedule(schedule)
      { 
      var rteReturnValue = new SCDatum(); var rteNames = new SCDatum(); rteNames.push("record"); var rteValues = new SCDatum(); rteValues.setType(8); rteValues=system.functions.insert(rteValues, 0, 1, schedule); system.functions.rte
      ...
      2010-02-12, 21:13
    Working...
    X