Forum Discussion

HenryRYng-d620c's avatar
HenryRYng-d620c
Community Member
9 months ago

Getting built in variables in JavaScript - Project.ActivityId

How can i access Slide.Id and Project.ActivityId from JavaScript?  

player.GetVar("Project.ActivityId") doesent do it an a trigger  of

"Set cmi5_objectId to value Project.ActivityId When the timleline starts on this slide" 

..also does not set it to my custom variable. 

  • ryanHepler's avatar
    ryanHepler
    Community Member

    Trying to do the same thing, and it's not working. 

    Used 

    let player = GetPlayer();
    let title = player.GetVar("Menu.SlideTitle"); //amongst other built in variables I've tried...

    console.log('title');

     

    Keep getting error: Path does not resolve at 'variable that I'm trying'....

    Did you end up figuring this out? 

     

  • Most built in variables cannot be read in JS. You can transfer to user created variable and read from there.

    • ryanHepler's avatar
      ryanHepler
      Community Member

      Hey PhilMayor thanks for the speedy reply, by transfer do you mean use a trigger to set those system variables to a custom variable? 

      Also, how do systems like Scorm cloud access them?

      We use an LRS and LMS, so don't need another tool like SCORM cloud, but we're having trouble getting the basic information from the page. Like Slide Title, User interacting with the Page, grade received, etc. 

       

      • HenryRYng-d620c's avatar
        HenryRYng-d620c
        Community Member

        @ryanHelper .. my question was on some obscure lesson metadata. In your case if you publish to cmi5 you would see slide title in the experienced / left verb statements.  if you need the title or slide id inside storyline those are accessible: "%Project.SlideTitle%"   %Slide.Id%" and the score ois written when the lesson is is completed in the completed statement.  Doa  hello world lesson, publish to cmi5 format , put in your LMS/LRS and look at the statements it made for the lesson. You should have them.