Skip to main content
Nintex Community Menu Bar

Quick question from a K2 newb

  • June 11, 2008
  • 2 replies
  • 12 views

Forum|alt.badge.img

When building a default server event, how would you access the value contained in a custom user created field?  Given a Main method for the server event such as below:


 public void Main(Project_8bebd413eeb74e06879d0811eafa8552.EventItemContext_589ce74800e64266a6e2ee9b94392134 K2)
        {
              
        }


 


Basically in object browser I created a separate folder called "Fields" and dropped a few field names such as "FromEmail" and "FileToExport". 


 Any help is much appreciated, thanks a bunch!

2 replies

Forum|alt.badge.img+11
  • June 11, 2008

When you say 'custom user created field', are you referring to environment variables?  If so, try something like:


string myvalue = K2.StringTable["FromEmail"];


 


Forum|alt.badge.img+9
  • June 11, 2008

if you have created a new data field called "FromEmail", you can access this in code by using:


K2.ProcessInstance.DataFields["FromEmail"].Value


if you have created a new xml field "Fields" with sub element "FromEmail", yoiu can access this in code by using:


K2.ProcessInstance.XmlFields[

"Fields"].Value

this will give you a string which contains an XML document - there will be a node in this string called "FromEmail", which you can extract using xml functions.

Hope this helps....