Creating Dynamic Dates in Storyline
Jun 04, 2015
Hi there,
Just thought I'd share, since I didn't find this elsewhere. I currently design courses in which the learner looks at example customer orders, and the question came up of a way to use screenshots but have the dates change so they don't become outdated. Dates would need to have the full month name printed, not just the month #. So, I grabbed a screen, whited out the dates, and went into some coding.
By using blank text variables on the slide combined with Execute JavaScript on timeline start triggers, it was able to create the effect I wanted!
Here is the javascript coding that I’ve made for getting today’s date to print, which can be called out by using the variable %systemdate%:
Here’s the code for generating "other" dates (modify the – 5 and +25 to set how many days ago – they always add to 30) and called out in this example with %shipdate% (you can modify that name on the final line to use a different variable:
9 Replies
This post was removed by the author
Thanks Jason for sharing here - always good to see other examples of how to set up something like this!
Jason, can you (or someone from the community) tell me how to set up the variable so that the javascript will work, PLEASE? I have a certificate at the end of my course and I'd like to have the date dynamic so that the certificate is current with the user completing the course. I created a trigger for the javascript and entered what you gave and created a variable called systemdate, but not sure what kind of variable to make it etc. Yikes....so much still to learn with this amazing program. THANKS!!!
Hi Sylvia!
This thread is a bit dated. You may want to reach out to Jason directly via the 'Contact Me' option on the user profile in case he is no longer subscribed.
JavaScript is not my specialty :)
Hi Matthew,
Thanks so much for the input! I've tried everything I can think of. I get the message when I preview that says can't view the javascript, but when I publish there is still nothing visible. I've tried moving it up the "ladder of operations". I've tried putting the trigger on the layer where I have the reference and I've tried putting the trigger on the object that triggers the layer, but it just doesn't show anything when published. I used the code from here https://www.articulate.com/support/storyline/javascript-best-practices-and-examples for the dynamic date, but just can't get it to show when published. I tried the html version and the html5 version. ????
When I try it on the Mac side of my computer a message comes up that my browser does not support the javascript. I get the same message on Safari and Firefox. I've tried unchecking the block pop-ups and made sure that Ghostery is paused and any java addons are always active. Sigh.
Thanks Leslie so much. Just sent him a message :)
It could be that Matthew, but I can't get it to work on Tempshare. I can't get it to publish on Tempshare. It gets to 99% of publishing and freezes. :(
Is your content set to publish for web or LMS? If LMS, you can test via SCORM Cloud.
I know our team has been looking into random Tempshare issues, but nothing consistent.
If you wish to share the file, perhaps we could try uploading.
Hi Leslie,
I'll work on getting an uploadable file and get it out there. THANKS.
Sylvia
Sounds great Sylvia. Just pop it in here when you're ready.
This discussion is closed. You can start a new discussion or contact Articulate Support.