Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created April 6, 2011 22:17
Show Gist options
  • Save mhulse/906660 to your computer and use it in GitHub Desktop.
Save mhulse/906660 to your computer and use it in GitHub Desktop.
Get staff e-mails via DTI's Content Publisher CMS. Language keywords: CSP (Caché Server Page), COS (Caché Objectscript)
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="email" arguments='name:%String=""' returntype="%String" procedureblock="1">
set return = ""
try {
set currentNS = $znspace
znspace ##class(dt.common.NamespaceProcs).GetLocationsName()
set sql =
"SELECT DISTINCT email " _
"FROM dt_enewsroom_schema.NewsroomContact " _
"WHERE fullName [ '" _ name _ "'"
set rs = ##class(%ResultSet).%New("%DynamicQuery:SQL")
set sc = rs.Prepare(sql)
if ($$$ISOK(sc)) {
set sc = rs.Execute()
if ($$$ISOK(sc)) {
if (rs.Next()) {
set return = rs.GetData(1)
}
}
}
znspace currentNS
} catch(e) {
; What to log and where?
}
quit return
</script>
<csp:comment>
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="26035312">
#(..email("First M Last"))#
</csp:comment>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment