I have 2 BOs; Template and TemplateTasks. TemplateTasks appear as a Table of Items in a section of the Template Form. The table is sorted by an attribute called SortOrder.
I have a rule on SortOrder to default an order when creating a new TemplateTask - this rule is set to work on initialization:
IF TemplateTasks IS NEW THEN TemplateTasks.SortOrder=MAX
TemplateTasks.SortOrder WHERE (TemplateTasks.Template=ThisTemplateTasks.Template)+1
I have a process to create a new TemplateTask
ENTER NEW TemplateTasks WITH TemplateTasks.Template=Template
Now, when I Add New, using the rule above, the Form appears, with the SortOrder defaulted correctly, but when I enter data and save the form the SortOrder is saved with a value that is +2 or the last SortOrder value and +1 of the value as it is displayed when entering a new task.
For instance, if the TemplateTask currently has two rows in it (sortorder numbers 1 and 2), when I click add, the New TemplateTask defaults the SortOrder to 3 (as expected), but when I save the form, the row is saved with a 4 rather than a 3.
Any ideas?