Forum Discussion

VanessaWylie's avatar
VanessaWylie
Community Member
10 years ago

How to insert current date variable into a "customised certificate slide".

Hi there,

I have created a certificate looking slide at the end of my course. I have added in variables for the learners name, their score achieved, I am just missing the date variable to be populated automatically. 

I have followed the guide on the link below however it has not worked when I have tested it in a clients LMS (SABA). https://vimeo.com/145579723 

I was just wondering if anyone could offer any assistance on this matter?

31 Replies

  • JohnBlum's avatar
    JohnBlum
    Community Member

    I tried to use this, but the value of the textbox was a blank space. 

    I have a blank slide with a textbox containing  the text"= %system_date%" was a blank space.

    This is the first time I tried using JavaScript in Storyline.  don't know why it's not working.  Any help would be appreciated.

  • Hi Mitzi, follow the steps below and you should be able to show the date

    1. Create a text variable called 'SystemDate'
    2. Create a text box for reference to the variable 'SystemDate'
    3. Add a trigger - execute Javascript when timeline starts the certificate looking slide 
    4. Copy and paste the code below in the Script coloumn

    var m_names = new Array("January", "February", "March",
    "April", "May", "June", "July", "August", "September",
    "October", "November", "December");
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth();
    var yyyy = today.getFullYear();
    if(dd<10) { dd='0'+dd }
    var date= m_names[mm]+' '+dd+', '+yyyy;
    var player = GetPlayer();
    player.SetVar("SystemDate",date);

    • VickieSublette's avatar
      VickieSublette
      Community Member

      Do you know how to make it appear in date/month/year format? For example, 12 September 2020

      • NatalieBowman's avatar
        NatalieBowman
        Community Member

        Hi, this worked for me.

        var m_names = new Array(" January", " February", " March",
        " April", " May", " June", " July", " August", " September",
        " October", " November", " December");
        var today = new Date();
        var dd = today.getDate();
        var mm = today.getMonth();
        var yyyy = today.getFullYear();
        if(dd<10) { dd='0'+dd }
        var date= ' '+dd+m_names[mm]+', '+yyyy;
        var player = GetPlayer();
        player.SetVar("SystemDate",date);