Appendix A. K2 blackpearl Tips and Tricks

When we started this book, we wanted to make sure that everyone who read it came away with some good information, not only from the information contained within each chapter but also from the insight each author provides. That in great part explains why the authors were chosen to participate. They come from a variety of fields and have a variety of experiences that should help you take advantage of the K2 platform. To further this idea we have collected various tips, tricks, and "how-to" information from a broader audience, including K2 employees from around the world and community representatives who have discovered some great time-saving techniques. Some of these things you may have seen before on various K2 blogs. Others will be new. We hope you find many of them useful.

Retrieving the Value from an XML Field Element

By Joseph Dunagan, K2 Consultant

Sometimes you need to get the value from an element within a K2 XML field. This is usually done within a server event. In the following example, I needed to retrieve a URL from a K2-generated XML field. This specific example should work if you do not expect repeating values in the Items node. For scenarios where repeating values are selected, you would need to change the XPath.

// get the full XML from the K2 XML field string strXML = K2.ProcessInstance.XmlFields["SPEventsField"].Value; // set the XPath to the desired node string strXPath = "/Items/Item/URL"; // use the helper class to retrieve ...

Get Professional K2 blackpearl® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.