I created an automation rule to test the new code: "
Every time a task is added or updated then do the following: run
code snippet"
If one or more tasks change, Select will run this code one or more times.
Each time, Select will pass you one task. This is what we mean when we say this makes the Context for the code a task.
One more thing, the only legal strings to pass to
note.Categories consists of valid categories numbers separated by commas or a single category number in a string. If you do not want to set a category, set the property to None or you will get an error.
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
# Context is 'Task'
def AddNote():
if Context.Description == "Prepare Owner's Policy":
note = IOrder.CreateNew(Context.Root, 'Note')
Context.Notes.Add(note)
note.Text = 'this is just a test: ' + str(DateTime.Now.ToString())
note.Categories = None # or '1' or '1,2'
note.Type = NoteType.Information
note.DisplayOnOrderOpen = False
AddNote()