Method Directive - UD Field Breaks Automated Email

Trying to send out an automated ship acknowledgement email. I’ve got the issue paired down to one line causing it not to fire. The line that breaks the code is referring to a UD field that contains the carrier name.


      sMessage += string.Format("<b>Packing slip {0} has been completed.</b>", ttShipHead_xRow.PackNum);
      sMessage += string.Format("<b>Carrier: {0}</b>", ttShipHead_xRow.UDField<bool>("CarrierLabel_c")); // this one breaks the automated email. If I remove it, the email fires correctly. 
      sMessage += string.Format("<br><b>Tracking Number: {0}</b>", ttShipHead_xRow.TrackingNumber);

This is what we get without the line:

image

There should be another line, above the tracking number that displays who the carrier is. Any one have any ideas on why this would cause the trigger to break?

Never mind, I figured it out. Sorry, noob mistake. It’s not a bool, it’s a string. Spotted it right after I made the post.

Had to change that line to:

sMessage += string.Format("<b>Carrier: {0}</b>", ttShipHead_xRow.UDField<string>("CarrierLabel_c"));

This is pretty universal for me. I get stuck I cannot see the problem and I send the email or ask the expert and as I’m doing that or just after I send it the problem jumps right out at me. So many…‘uhh nevermind’ comments in my life.

2 Likes

I definitely have these moments more often than I like to admit lol