Adding an Activity Formatter Section to any Table

Activity formatters give you a way to present the audit history of a particular record. Out-of-box, there is an activity formatter set up for the ‘Task’ table (which is available to any of its extended tables). As long as the table is audited, you can use an activity formatter to show a personalized view of the history (and associated sent and received emails) for each record directly on the form.


In most cases, it’s enough just to have an activity formatter on the task tables. You may find it necessary to add an activity formatter to a different table in your implementation. Recently I had a client who wanted to see all of the sent and received emails for approvals associated with a change request. Normally, sent and received emails are displayed as part of an activity formatter but since the Approval (sysapproval_approver) table isn’t a task table it doesn’t have an activity formatter. Since the approval table is audited you can view the history of each record, but you can’t see sent and received emails from that view. After just a few clicks, the client was able to add the formatter to the approval table and see the information they needed. Click here to see the wiki documentation explaining how to add an activity formatter to any table.

Don’t forget to right-click the activity section header and Personalize activities for your activity formatter after you’ve added it to your form!

Date Posted:

January 22, 2010

Share This:

14 Comments

  1. akshat chawla June 27, 2012 at 7:36 am

    Hi

    In the activity formatter there is a time shown that when it’s updated and by whom. I wanted to add Timezone with that time…
    Is this Possible. If yes then how????

    Can anyone tell the solution

    • Mark Stanger June 27, 2012 at 7:38 am

      It’s not possible to modify the existing formatter unfortunately.

      • Jim Pisello August 14, 2012 at 6:35 am

        What about creating a copy of the default formatter and modifying that? I don’t see the activity formatter UI Macro anywhere in the list (probably because SNC don’t want us mucking around with it!) but it’d be nice to at least have the XML so we could use it as a starting point for our own formatter UI Macro.

  2. ND December 7, 2012 at 2:21 pm

    Hi Mark,

    Is is possible to restrict Send/Receive emails from activity formatter. I want a particular role not to see emails if he is not a part of recipient.

    Regards,
    ND

    • Nikhil Nishant June 12, 2014 at 9:03 am

      To configure this property:

      Navigate to System Properties > UI Properties.
      Locate the following property:
      “List of roles (comma separated) that can view emails in the Activity Formatter when “Sent/Received Emails” are included.”
      Add roles to the property, separated by commas.
      These are the only roles that can see emails in the activity formatter. All other roles are blocked from seeing emails. If no roles are listed, all users can see emails. As of the Berlin release, the itil role is on the list by default.
      Click Save.

  3. Michele December 13, 2012 at 11:46 am

    How about activity formatter to show changes to variables on a requested item? I see that the changes to the variables are stored in the sys_history_set tables but not sure how to get them into the activity log with the variable question instead of the variable name. Has anyone else done something like this?

    Thanks-Michele

    • Mark Stanger December 13, 2012 at 11:50 am

      @Michele, I’ve never seen that done. You’d likely have some pretty significant jelly scripting in front of you if you wanted to do that.

  4. Michele December 13, 2012 at 1:22 pm

    That’s what I suspected. I am looking at a few other options. I created a modified version of the Audit History relationship that just presents the audit history of fields with label starting with “VARIABLES” and set it as a embedded list in the Requested Item form. Only downside is it stores the variable name instead of the question.

    I’m about to start looking at business rule that captures all the field changes on update (like when we send email notification on Incident updated to the watchlist with a list of the changed fields/values) but I suspect it doesn’t treat the variables as field changes. Also want to look at onSubmit client script to try to capture what variables may have been changed.

    I really just want to let the approver know if any of the variables have changed before they approve again. If we can show in a journal field or something that variable “How many users are impacted” changed from 3 to 300 that would be enough. Not a great example but you get the idea.

    Any thoughts on this?

    Thanks,
    Michele

    • Steve H December 13, 2012 at 2:23 pm

      Michele,
      What we have done is created a business rule on our sc_task table that populates the worknotes on the task with the variable changes.
      This might give you a idea for the item table.
      I can see creating a new journal field specifically for variable changes if you didn’t want them in the work notes.

      Table: sc_task
      When: Before
      Update=true

      var questions = getQuestions(current.request_item.sys_id, current.sys_id);

      var workNote = ”;
      for (name in current.variable_pool) {
      if (previous.variable_pool[name] != current.variable_pool[name]) {
      var q = getQuestion(questions, name);
      if (workNote != ”) {
      workNote += ‘\n\n’;
      }
      if (q != null) {
      workNote += “Question ‘” + q.getLabel() + “‘ changed to:\n” + current.variable_pool[name].getDisplayValue();
      } else {
      workNote += “Question ‘” + name + “‘ changed to:\n” + current.variable_pool[name].getDisplayValue();
      }
      }
      }
      if (workNote != ”) {
      current.work_notes.setJournalEntry(workNote);
      }

      function getQuestion(questions, name) {
      for (var x = 0; x < questions.size(); x++) {
      var q = questions.get(x);
      if (q.getName() == name) {
      return q;
      }
      }
      return null;
      }

      function getQuestions(itemID, taskID) {
      var qs = new Packages.com.glideapp.servicecatalog.variables.VariablePoolQuestionSet();
      qs.setRequestID(itemID);
      qs.setTaskID(taskID);
      qs.load();
      var fQuestion = qs.getFlatQuestions();
      return fQuestion;
      }

      • Jim Pisello December 14, 2012 at 7:03 am

        Steve, this is a great modification for those who use the variable editor. We’ve stayed away from it for the most part but we’re starting to use it in some limited cases, and having an easy way to see which variables have been changed as the task is processed is going to be very useful for us. Thanks for providing this solution.

  5. Michele December 13, 2012 at 2:45 pm

    Two words: You Rock!!

    Thanks a bunch, I really like this solution.
    Michele

  6. Nabilah January 14, 2013 at 2:07 am

    Mark,

    How can I add Outage record update of an Incident in the activity log so that users can review the outage changes in the activity log..?

    Thanks.

    • Mark Stanger January 14, 2013 at 3:35 am

      Simplest way is just to script the update into the ‘Comments’ field of the incident record.

  7. Nikhil Nishant June 12, 2014 at 9:05 am

    Hi,

    Can anyone help me with including Emails in the “Activities” in a Change Request Form?

    Thanks.

Comments are closed.

Categories

Tags

Loading

Fresh Content
Direct to Your Inbox

Just add your email and hit subscribe to stay informed.