That's probably because you need to escape the ' character. I'm a bit unsure where you get the "Company's email" value from. But I think it's simply a matter of handling it by either removing it and make a comparison without it if I get what you're trying to do correctly. Or as mentioned simply ecsape the character somehow.
Apostrophe in Caption field does not send email
Hi ,
I am using Contour and am trying to send email based on EmailLookup Field which has apostrophe in it.
When am removing apostrophe it sends email but not when having it :(
It gives me following error "System.xml.xpath.xpathexception [caption="company's email address"]" has an invalid token
having apostrophe in caption filed is important to me
Any ideas??
Thanks
Hi Lucky and welcome to our :)
Could you post your code in here as it may be easier to point you in the right direction.
Also it might be a good idea to have a look in the /app_data/logs file to see if it reveals something usefull.
Cheers, Jan
Thanks for the reply Jan
all I am trying to do is i created a form in Contour
and added a field with caption called Company's email
then i used a workflow to populate email address
like in this example
http://our.umbraco.org/wiki/how-tos/extending-contour,-sending-email-dependent-on-form-selection
private IEnumerable<string> GetEmailAddressesViaLookUp(XmlNode xml, string emailBody)
{
// EmailLookUpField - this is the field which we have specified in the workflow that has the email address
// values assigned to them, in our case the "Sectors" checkbox list.
string xpath = string.Format(LookUpFieldXpath, EmailLookUpField);
string fromEmailXpath = string.Format(LookUpFieldXpath, EmailFrom);
var addresses = new List<string>();
XmlNode destiniationIds = xml.SelectSingleNode(xpath);
XmlNode fromEmail = xml.SelectSingleNode(fromEmailXpath);
XmlNode emailFromNode = fromEmail.SelectSingleNode("values/value");
EmailFrom = emailFromNode.InnerText;
if (destiniationIds != null)
{
// Loops through the the List of emails and sends an email to each department
IEnumerable<string> emails = ExtractSectorsFromNodeXml(destiniationIds);
foreach(string email in emails)
{
SendMail(emailAdress, Subject, emailBody);
}
}
return addresses;
}
here my xmlNode destinationIds is showing null if i have apostrophe in my lookup field :(
Hi Lucky
That's probably because you need to escape the ' character. I'm a bit unsure where you get the "Company's email" value from. But I think it's simply a matter of handling it by either removing it and make a comparison without it if I get what you're trying to do correctly. Or as mentioned simply ecsape the character somehow.
Btw there's more Contour documentation here if you're not aware http://our.umbraco.org/projects/umbraco-pro/contour/documentation
/Jan
is working on a reply...