Documentation > CMS Template API Library > Context > ExecutedById
ExecutedById
The asset id of the asset that is executing this template. Only populated if the current template is called by another such as when using an Asset.Show() or Asset.GetLink() command. Calling template must also be a C# template.
Type
Nullable<Int32>
Value
The asset id of the calling asset, if set. Otherwise it will be null. Use context.ExecutedById.HasValue to check.
Code Example
C#
Sample:
if (context.ExecutedById.HasValue) { Out.WriteLine(" I was shown by " + context.ExecutedById.Value); } int executedBy = context.ExecutedById??-1; if (executedBy != -1) { Out.WriteLine(" I was shown by " + executedBy); }