Runtime verified

Syntax

AuthenticatedEmployeeID()  →  string
0 arguments — exactly

Parameters

This function takes no parameters.

Example

%%[
  VAR @employeeId
  SET @employeeId = AuthenticatedEmployeeID()
]%%
User: %%=v(@employeeId)=%%

Renders a nine-digit numeric ID — on the business unit tested, the same value on every request, including anonymous ones.

The value is an ordinary string, so it composes normally:

%%[
  VAR @employeeId, @label
  SET @employeeId = AuthenticatedEmployeeID()
  SET @label = Concat("employee-", @employeeId)
]%%
%%=v(@label)=%%

What it does not support is a sign-in check — see below.

Return value

string — a numeric employee ID.

The value domain is open: an ID is an account-scoped number, so there is no closed set of sentinel values to test for. In particular there is no “not signed in” sentinel — an unauthenticated request gets an ordinary ID back.

Behaviour

A public CloudPage request gets a value, not an empty result. An anonymous request to the published URL, carrying no Marketing Cloud session at all, rendered a nine-digit ID at HTTP 200. Empty() on the same value answered false and Length() gave nine.

The result is a value, not a page-terminating call. It compared against the empty string, rendered inline without a variable, and rendered unchanged nested inside a Concat between two surrounding characters. Every line after the call still rendered.

The value is stable inside one render. Three separate calls in the same request — an assignment, an inline call and a nested call — produced identical digits.

Do not use it as an authentication check

Because a value always comes back, a page cannot infer from a non-empty result that its visitor is a signed-in Marketing Cloud user. Content gated on that check would be open to everyone. Use a real authentication mechanism for the gate and treat this function as context information only.

Show test script
%%[
  VAR @b, @aeid
  SET @b = RequestParameter("b")

  /* known-good control: renders on every request, so a run of HTTP 422s
     can be told apart from a deploy that failed to compile */
  OutputLine(Concat("CTRL=[", Uppercase("ok"), "]"))

  OutputLine(Concat("--- AEID start ---"))

  /* a plain anonymous request still produces a value */
  SET @aeid = AuthenticatedEmployeeID()
  OutputLine(Concat("AEID=[", @aeid, "]"))

  /* confirmed with a second function rather than read off empty brackets */
  OutputLine(Concat("AEID_EMPTY=[", IIf(Empty(@aeid), "empty", "not-empty"), "]"))
  OutputLine(Concat("AEID_LEN=[", Length(Concat(@aeid, "")), "]"))

  /* the value is usable inline, nested and in a comparison */
  OutputLine(Concat("AEID_DIRECT=[", AuthenticatedEmployeeID(), "]"))
  OutputLine(Concat("AEID_IN_CONCAT=[", Concat("<", AuthenticatedEmployeeID(), ">"), "]"))
  OutputLine(Concat("AEID_CMP=[", IIf(@aeid == "", "eq-emptystring", "ne-emptystring"), "]"))
  OutputLine(Concat("--- AEID done ---"))

  /* argument counts the signature does not allow: each aborts its branch */
  IF @b == "ar1" THEN
    OutputLine(Concat("--- ar1 start ---"))
    OutputLine(Concat("AEID1=[", AuthenticatedEmployeeID("x"), "]"))
    OutputLine(Concat("--- ar1 done ---"))
  ENDIF

  IF @b == "ar2" THEN
    OutputLine(Concat("--- ar2 start ---"))
    OutputLine(Concat("AEID2=[", AuthenticatedEmployeeID("x", "y"), "]"))
    OutputLine(Concat("--- ar2 done ---"))
  ENDIF
]%%

Availability

Platform Available
Marketing Cloud Engagement Yes
Marketing Cloud Next No

The official reference scopes this function to microsites using sender authenticated redirection and states it is not for CloudPages. That authenticated path was not exercised here — a public CloudPage cannot supply such a session — so everything on this page describes the unauthenticated CloudPage context only, and no claim is made about whose identity the returned ID represents.

See also