We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

jeffreyfolt
ServiceNow Employee

Welcome to the ServiceNow Knowledge19 Pre-Conference - Scripting in ServiceNow Fundamentals!

This is a dedicated Community Article for class communication, collaboration, and fun!!

Comments
Graham Strydom1
Kilo Explorer

If you don't already have your own ServiceNow developer instance then head to http://developer.servicenow.com to request one.

Marcel Clemens
ServiceNow Employee

Here are the additional Conference Sessions.

find_real_file.png

Marc Roy
Tera Guru

FYI. LAB 2.04 is listed as "Lab 2.5 Reference Object" when following Step #1 of the lab.

Ricky Quinn
Kilo Expert

Did anyone else notice the "risk" in the last lab 2.4/2.5, when scripting, actually added "5" as a choice? To fix, you can add the missing risk choices from available to selected. 

 

find_real_file.png

Marcel Clemens
ServiceNow Employee

Yes, your are right.

Thanks for sharing that.

Graham Strydom1
Kilo Explorer

To learn more about Javascript loops go to https://www.codecademy.com/articles/fwd-js-loops

lizzyt603
Tera Contributor
lizzyt603
Tera Contributor

For those completing the Flow Designer Lab 11.03 - here is the appended snippet:

(function execute(inputs, outputs) {
  var startDate = new GlideDateTime(inputs.created_on);
  var endDate = new GlideDateTime(inputs.resolved_at);
  
  var calcDiff = GlideDateTime.subtract(startDate, endDate).getRoundedDayPart();
  
  var report = "After Action Report\n" +
      "Subject: After Action Report, " + inputs.assigned_to  + " – " + inputs.assignment_group + "\n" +
      inputs.created_on  + " – " + inputs.resolved_at + "\n\n" +
      inputs.number + " with '" + inputs.short_description + "' was entered into ServiceNow by " +
      inputs.created_by + " for " + inputs.caller_id + ". " +
      "The Configuration Item affected was " + inputs.cmdb_ci + " . " +
      "Resolved by " + inputs.resolved_by + " with a Resolution code of " + inputs.closed_code + "." +
      "Resolution notes are as follows: " + inputs.close_notes + "\n\n" +
      "Total time: " + calcDiff + " Days";

  outputs.Payload = report;
  
})(inputs, outputs);
Version history
Last update:
‎04-29-2019 07:25 PM
Updated by: