Manage Learn to apply best practices and optimize your operations.

Verify scheduled agent status with Domino Extensible Language (DXL)

Discover how to use Domino Extensible Language (DXL) to check the status of active scheduled agents on Lotus Domino servers and in Notes databases.

Related resources from
Featured Topic: Domino Extensible Language (DXL)

Enable or disable scheduled agents without opening the Lotus Notes database design

Monitoring scheduled agents by email

DXL (Domino Extensible Language) allows you to check the status of scheduled agents that are enabled in the Lotus Domino server and/or the local Lotus Notes database.

Follow these steps to set up the DXL to check the status of these enabled agents.

  1. Create a Lotus Notes form called: "XSL Sheet | XSLSheet" with the following text fields:

    • "Title"
    • "Filename"
    • "Comments"
    • Next, create a rich-text field called "XSLBody"

  2. Create a Lotus Notes view called "XSLSheets," with "View Selection" SELECT Form="XSLSheet." "Title" should be listed as the first sorted column.
  3. Create a Lotus Notes document with the Title: "ScheduledAgentDetails," the Filename: "ScheduledAgentDetails.xsl" and your previously created rich-text field: "XSLBody."

    This rich-text field should contain the following extensible style sheet language transformation (XSLT) code to display the data, which refers the DXL of the specified Lotus Notes database.

<<?xml version="1.0" encoding="UTF-8"?>
<<xsl:stylesheet xmlns:xsl=
"" version="1.0"   

<<xsl:output method="html" indent="yes" />

<<!-- To get the Sever Name and Database Name 
entered by the User --> <<xsl:param 
name="ServerName" /> <<xsl:param name="DB" />
<<!-- End -->

<<xsl:template match="dxl:database">
<<title>Scheduled Agent Details<</title>
<table border="0" width="100%">
<td align="center">
Details of Scheduled Agents (Enabled) in the Database<br/>
<xsl:value-of select="$ServerName" 
/><xsl:text>/</xsl:text><xsl:value-of select="$DB" />
<table border="1" width="100%">   
<th align="center">Agent Name</th>
<th align="center">Scheduled Type</th>
<th align="center">Agent Last Run</th>
<xsl:apply-templates select="dxl:agent" />


<xsl:template match="dxl:agent">
  <xsl:param name="lastrun" 
select="dxl:rundata/dxl:agentrun/dxl:datetime" />
  <xsl:param name="scheduleType" 
select="dxl:trigger/dxl:schedule/@type" />
  <xsl:param name="lastruntime" 
select="substring-after($lastrun,'T')" />
  <xsl:param name="lastrunzone" 
select="substring-after($lastrun,',')" />
  <xsl:variable name="str-length" 
select="string-length($lastrunzone)" />
  <xsl:variable name="timezone">
<xsl:when test="$str-length = '7' ">
<xsl:value-of select="concat(substring
($lastrunzone,3,3), ':', substring($lastrunzone,6,2))" />
<xsl:when test="$str-length = '5' ">
<xsl:value-of select="concat(substring
($lastrunzone,3,3), ':00')" />
<xsl:value-of select="$lastrunzone" />
<td><xsl:value-of select="@name" /></td>
<!-- <xsl:value-of select=
"dxl:trigger/dxl:schedule/@type" /> -->
<xsl:when test="$scheduleType = 
'daily'" >Daily </xsl:when>
<xsl:when test="$scheduleType = 
'weekly'">Weekly </xsl:when>
<xsl:when test="$scheduleType = 
'monthly'">Monthly </xsl:when>
<xsl:when test="$scheduleType = 
'never'">Never </xsl:when>
<xsl:otherwise>More than once
 a day </xsl:otherwise>
<xsl:when test="$lastrun != '' " >
<xsl:value-of select="concat(substring
' Time ', substring($lastruntime,1,2), ':',
':',substring($lastruntime,5,2), '.', 
' Zone ', $timezone )" />
  1. Create a LotusScript agent called "ScheduledAgentStatus," and copy the following code.
Option Public
Option Explicit

Sub Initialize
On Error Goto oops

Dim session As New NotesSession
Dim servername As String
Dim dbstring As String
Dim db As NotesDatabase
Dim Out As String
Dim filenum As Integer
Dim filename As String
Dim agent As NotesAgent
Dim stream As NotesStream
Dim nc As NotesNoteCollection
Dim exporter As NotesDXLExporter
Dim path As String
Dim nccount As Integer
Dim currdb As NotesDatabase
Dim xslview As NotesView
Dim xsldoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim stylesheet As NotesStream
Dim transformer As NotesXSLTransformer  
Dim htmlout As NotesStream

Set currdb = session.CurrentDatabase

servername = Inputbox$("Enter the 
Server Name", "Server Name", "")
dbstring = Inputbox$("Enter the complete 
path of the Database", "Database Path", "")

If dbstring <> "" Then   
Set db = New NotesDatabase(servername, dbstring)
If db.IsOpen  Then
path = "C:"
filename = servername & "-" & Left(db.FileName, 
Len(db.FileName) - 3) 
Set nc = db.CreateNoteCollection(False)
Call nc.BuildCollection 
nccount = nc.Count

Forall a In db.Agents
Set agent = a
If agent.IsEnabled Then
Call nc.Add(agent)
End If
End If
End Forall

If nc.Count > 0 Then    
Set stream = session.CreateStream
If Not stream.Open(path & filename & "dxl") Then
Messagebox "Cannot open " & filename & "dxl",, "Error"
Exit Sub
End If
Call stream.Truncate
Set exporter = session.CreateDXLExporter(nc, stream)
exporter.OutputDOCTYPE = False
Call exporter.Process       

If nc.Count - nccount > 0 Then
Messagebox Cstr(nc.Count - nccount ) 
& "  Enabled Scheduled  Agents found", , _
End If   

Set xslview = currdb.GetView("XSLSheets")
Set xsldoc = xslview.GetDocumentByKey
("ScheduledAgentDetails", True)
Set rtitem = xsldoc.GetFirstItem("XSLBody")
Set stylesheet = session.CreateStream
If Dir$(path & filename & "html",16) <> "" Then
Kill path & filename & "html"    
End If
Set htmlout = session.CreateStream
Call htmlout.Open(path & filename & "html")
Set transformer=session.CreateXSLTransformer
(stream, stylesheet, htmlout)   
Call transformer.AddParameter("ServerName", servername)
Call transformer.AddParameter("DB", dbstring)
Call transformer.Process
Messagebox "Scheduled Agents (Enabled) not 
found in the specified Database"
Exit Sub
End If
Messagebox "Specified database " & 
servername & "/" & dbstring & " doesnot exists."
Exit Sub
End If  
If Messagebox("Invalid Database path! 
Do you want to try again?", _
IDYES Then Goto _
Exit Sub  
End If
Goto done

Messagebox " Error " & Error() & " at " & Erl()
Messagebox " File " &  path & filename & 
"html" & " created successfully"
End Sub

Note: This agent is designed for use with Lotus Notes and Domino only. In this agent, inputbox will prompt the Lotus Notes user to obtain details of the complete path for which the "Status of Enabled Scheduled Agent(s)" is known for the Lotus Domino server and Lotus Notes database.

If the specified Lotus Notes database exists, it will create the DXL for the Lotus Notes database in C://. Using the created DXL and the "ScheduledAgentDetails style sheet" creates the HTML file in C:// with the scheduled agent(s) status.

Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Gowri MJ. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on Lotus Notes Domino Agents

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...