Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 8 of 8

Thread: Setting $file in JS

  1. #1
    Senior Member
    Join Date
    Jun 2007
    Location
    Australia
    Posts
    197

    Default Setting $file in JS

    Hey guys,

    I have a J-script at the moment which rtecalls script.execute. this all works wonderfully... however while running the script, $file is null.
    Is there a way i can fill $file with the specific record i'm using?

    so in my values for the script execute i have:

    argVal=newSCDatum();
    argVal.setType(2);
    argVal.push("script.name");
    argVal.push(system.vars.$file) ;
    argVal.push("true") ;
    argVals.push(argVal);
    print(argVals) ;

    and below i just have a
    print(system.vars.$file);

    This prints as "null". can i populate this $file with a doselect or some other?

    any guidance appreciated!

    Cheers,
    Lukus

  2. #2
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    714

    Default

    Where are you running this script from?

  3. #3
    Senior Member
    Join Date
    Apr 2006
    Location
    United States
    Posts
    178

    Default

    depends on where u are calling it from, but try vars.$L_file
    Also, what happens when you print the variable at the top of the function?

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Location
    Australia
    Posts
    197

    Default

    i was just calling it from script library. eventually i'll add it to a schedule record.
    i have tried to add the Incident number instead of $file in the script execute, but then i get a whole heap of errors.

  5. #5
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    714

    Default

    You've got this all wrong then. If you're intending to call this from a schedule, you need to retrieve the incident first. It's not going to just be in memory for you.

  6. #6
    Senior Member
    Join Date
    Jun 2007
    Location
    Australia
    Posts
    197

    Default

    yeah, exactly.
    so i've done a select, and i have updated some fields in the incident no worries, then i want to call a script.exeute to make an eventout, but $file is not set.
    so to the original question, how do i set $file?
    or can i use a different variable for call the script.execute?

  7. #7
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    714

    Default

    You don't need $file. You should be able to pass the javascript variable (the SCFile you created earlier).

  8. #8
    Senior Member
    Join Date
    Jun 2007
    Location
    Australia
    Posts
    197

    Default

    ohh.... excellent!

    thanks glg!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts