Skip to main content

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!

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


string myvalue = K2.StringTablel"FromEmail"];


 


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.XmlFieldsd

"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....


Reply