Hi,
I created this macro but it doesn't seem to work.
// Makes all methods in the 'CustomMacroMethods' container class available for string objects
[assembly: RegisterExtension(typeof(CustomMacroMethods), typeof(string))]
// Registers methods from the 'CustomMacroMethods' container into the "String" macro namespace
[assembly: RegisterExtension(typeof(CustomMacroMethods), typeof(StringNamespace))]
public class CustomMacroMethods : MacroMethodContainer
{
[MacroMethod(typeof(string), "Get the answer detail text to email", 2)]
[MacroMethodParam(0, "param1", typeof(string), "Partial node alias path to question")]
[MacroMethodParam(1, "param2", typeof(string), "Second part of the string completes the node alias path with the answer to email.")]
public static object GetAnswer(EvaluationContext context, params object[] parameters)
{
switch (parameters.Length)
{
case 2:
string questionPath = ValidationHelper.GetString(parameters[0], "");
string answer = ValidationHelper.GetString(parameters[1], "");
string nodeAliasPath = string.Format("{0}/{1}", questionPath, answer);
CMS.DocumentEngine.TreeProvider tp = new CMS.DocumentEngine.TreeProvider();
TreeNode node = tp.SelectSingleNode(CMS.SiteProvider.SiteContext.CurrentSiteName, nodeAliasPath, "");
if (node != null)
return node.GetStringValue("AnswerExplanation", "");
else
return string.Empty;
default:
throw new NotSupportedException();
}
}
}
I use it in my autoresponder as follows
{% "/Take-the-Test/TakeTheTest/Question1".GetAnswer($$value:Question1$$) |(identity)GlobalAdministrator%}
I get nothing back. Any ideas?