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¶
Create()initializes text/source/category/action to empty, setsNotepadFlagandDeleteFlagtoN(BR-015), setsCreateUserfromMyCriteria.CreateUseror, when blank, fromMyCriteria.DataPortalInfo.UserID(BR-014), copies it intoUpdateUser, stampsCreateDate/UpdateDate=Now, and marks the smart-type fields as original.- Property setters mark the object dirty:
MailIDsetter uppercases/trims the value and firesCheckRules("TaskUser")(BR-016).TaskDatesetter routes throughAssignTaskDate(see Assign and normalize a task due date).Textsetter coercesNothingtoString.Empty(BR-027).- On save, the framework runs the rules registered in
AddBusinessRules: - Category, source, priority, and MailID required (BR-001, BR-002, BR-003, BR-004).
ValidSourceCategorychecks the source/category combination againstTASK_CATEGORY_CODE(BR-005, SQL-005, TASK_CATEGORY_CODE).CheckDatevalidates a current-or-future date unless the task is batch-created (BR-006, BR-007).CheckDateModifiedraises a non-blocking warning if the date was auto-shifted (BR-008).- A failing rule blocks persistence unless the descendant's
OverrideRulesconverts it to a pass (BR-026). - On failure: the save is blocked and the object carries the rule's error message.
BeforeInsertbuilds aNonQueryStoredProcedurerequest (DataRequest.ID = "INSERT") againstpk82036_task.task_insertand 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 — plusRowsAffectedas aReturnValue(SQL-001, TASK).Origin: The
task_insertprocedure body resides in the Oracle database and was not retrieved in this analysis pass — its internal logic (e.g.,TASK_SEQ_NUMassignment) is unverified.**- Framework executes the request against the DPI.
AfterInsertreadsRowsAffected:- If
<> 1:AddErrorMessage("InsertError", "Task Insert Failed")(BR-010). - 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 <> 1after insert surfacesInsertError= "Task Insert Failed" rather than throwing (BR-010).- The
TaskCategoryCodeTextRequiredrule appears to be registered twice inAddBusinessRules; whether this produces a duplicate error message depends on framework rule de-duplication behavior**.
Related documentation¶
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