This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Need simple Method example.

Andy - Tuesday, January 16, 2007 10:49 AM:

I'm new to Innovator methods, and want to start simple.  Can someone give me an example of a simple method to modify a property?

(Ideally a method that does something like change a boolean property value from 0 to 1.)  I want to put it on a lifecycle.

Thanks in advance!



RobMcAveney - Tuesday, January 16, 2007 11:48 AM:

Refer to the Innovator Programmer's Guide for some examples of methods.  You can download it from:

 

Here is some simple code to cover your exact example.  This is a C# server method attached to the Life Cycle Map on a Pre-Transition event.  It sets the value of a boolean property named "promoted_flag" to true (1):

    this.setAction("edit");
    this.setProperty("promoted_flag","1");
    Item resultItem = this.apply();
    return resultItem; 

If for any reason the operation fails, the transition will be canceled and an error message will be returned to the user.  The same code in VB looks like this:

    Me.setAction("edit")
    Me.setProperty("promoted_flag","1")
    Dim resultItem As Item = Me.apply()
    Return Me