would have yielded a comma separated list of all values...
Normally, I would use logging to debug this but it also seems logging is not working on my instance (U6.0.6, Contour 3.0.17). Log files are created but no content is available in them.
private string CreateEmailList(Record record)
{
var viewer = new RecordsViewer();
XmlNode xml = viewer.GetSingleXmlRecord(record, new XmlDocument());
XPathNavigator navigator = xml.CreateNavigator();
XPathExpression selectExpression = navigator.Compile("//fields/child::*");
selectExpression.AddSort("@pageindex", XmlSortOrder.Ascending, XmlCaseOrder.None, string.Empty, XmlDataType.Number);
selectExpression.AddSort(
"@fieldsetindex", XmlSortOrder.Ascending, XmlCaseOrder.None, string.Empty, XmlDataType.Number);
selectExpression.AddSort("@sortorder", XmlSortOrder.Ascending, XmlCaseOrder.None, string.Empty, XmlDataType.Number);
XPathNodeIterator nodeIterator = navigator.Select(selectExpression);
List<string> lEmails = new List<string>();
while (nodeIterator.MoveNext())
{
if (nodeIterator.Current == null)
{
continue;
}
XPathNavigator node = nodeIterator.Current.SelectSingleNode(".//value");
XPathNavigator captionNode = nodeIterator.Current.SelectSingleNode("caption");
if (captionNode != null)
{
string caption = captionNode.Value;
if (caption.Contains("Member Groups"))
{
XPathNodeIterator values = nodeIterator.Current.Select(".//value");
while (values.MoveNext())
{
if (values.Current != null)
{
string[] strUsers = Roles.GetUsersInRole(values.Current.Value);
foreach (string strUser in strUsers)
{
lEmails.Add(Membership.GetUser(strUser).Email);
}
}
}
}
}
}
return String.Join(",", lEmails.ToArray());
}
But I still want to understand why the "non XPath" way (i.e. by using the Record object and its properties directly) does not work ... The above is much to clunky....
Issues with custom Workflow
I have a form that uses a checkboxlist (with string pre values).
This form produces following record:
I have created a custom WorkflowType that is needed to send a custom Email to members of my site.
In fact,
Contains an enumeration of the "Roles" for my site.
The important part of my WorkflowType:
Just to be clear "SendMail()" works if I leave out the 3rd argument (i.e. replace it by some random string).
It seems I can extract meaningful record fields for all but "membergroups". I would have expected
would have yielded a comma separated list of all values...
Normally, I would use logging to debug this but it also seems logging is not working on my instance (U6.0.6, Contour 3.0.17). Log files are created but no content is available in them.
Did further testing...
This works:
But I still want to understand why the "non XPath" way (i.e. by using the Record object and its properties directly) does not work ... The above is much to clunky....
is working on a reply...