Skip to content

Createinsert a task

This operation initializes a new concrete task instance with default values, runs the common validation rules, and persists it via the pk82036_task.task_insert stored procedure.

Field Value
Operation ID OP-2
Trigger Application creates a concrete task and calls Save()
Inputs New clsTask instance (concrete subclass)
Outputs Inserted TASK row; TaskSeqNum assigned by the procedure
Primary components clsTask.Create, clsTask.BeforeInsert, clsTask.AfterInsert
Entry point SAIF.Business.Tasks/clsTask.vb

Steps

  1. Create() initializes text/source/category/action to empty, sets NotepadFlag and DeleteFlag to N (BR-015), sets CreateUser from MyCriteria.CreateUser or, when blank, from MyCriteria.DataPortalInfo.UserID (BR-014), copies it into UpdateUser, stamps CreateDate/UpdateDate = Now, and marks the smart-type fields as original.
  2. Property setters mark the object dirty:
  3. MailID setter uppercases/trims the value and fires CheckRules("TaskUser") (BR-016).
  4. TaskDate setter routes through AssignTaskDate (see Assign and normalize a task due date).
  5. Text setter coerces Nothing to String.Empty (BR-027).
  6. On save, the framework runs the rules registered in AddBusinessRules:
  7. Category, source, priority, and MailID required (BR-001, BR-002, BR-003, BR-004).
  8. ValidSourceCategory checks the source/category combination against TASK_CATEGORY_CODE (BR-005, SQL-005, TASK_CATEGORY_CODE).
  9. CheckDate validates a current-or-future date unless the task is batch-created (BR-006, BR-007).
  10. CheckDateModified raises a non-blocking warning if the date was auto-shifted (BR-008).
  11. A failing rule blocks persistence unless the descendant's OverrideRules converts it to a pass (BR-026).
  12. On failure: the save is blocked and the object carries the rule's error message.
  13. BeforeInsert builds a NonQuery StoredProcedure request (DataRequest.ID = "INSERT") against pk82036_task.task_insert and adds 21 input parameters — create/update user, delete & notepad flags, task user (MailID), action/category/priority/source codes, date, text (4000), policy number, claim ID, image sequence number, task security, and the six context values — plus RowsAffected as a ReturnValue (SQL-001, TASK).

    Origin: The task_insert procedure body resides in the Oracle database and was not retrieved in this analysis pass — its internal logic (e.g., TASK_SEQ_NUM assignment) is unverified.**

  14. Framework executes the request against the DPI.
  15. AfterInsert reads RowsAffected:
  16. If <> 1: AddErrorMessage("InsertError", "Task Insert Failed") (BR-010).
  17. Otherwise: removes the message and calls MarkOld().

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Save called on new task]) --> S1[Create initializes defaults]
    S1 --> S2[Property setters mark dirty]
    S2 --> D{Business rules pass?}
    D -->|No| ErrEnd([Save blocked, error surfaced])
    D -->|Yes| S3["BeforeInsert builds<br>task_insert request"]
    S3 --> S4[Framework executes request]
    S4 --> D2{RowsAffected = 1?}
    D2 -->|No| ErrEnd2(["InsertError: Task Insert<br>Failed"])
    D2 -->|Yes| EndOk([MarkOld — task persisted])

Failure and edge-case behavior

  • Any registered rule failure blocks the save unless overridden by the descendant (BR-026).
  • RowsAffected <> 1 after insert surfaces InsertError = "Task Insert Failed" rather than throwing (BR-010).
  • The TaskCategoryCode TextRequired rule appears to be registered twice in AddBusinessRules; whether this produces a duplicate error message depends on framework rule de-duplication behavior**.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Business.Tasks/clsTask.vb