system.kanoa.quality.sheet.updateSheetVersionState
Description
Updates a check sheet's version state (for example, to Released). Handles creating copies, archiving, renaming, and master ID updates as needed based on the requested transition.Syntax
updateSheetVersionState(masterChkShtId, chkShtId, chkShtVersionStateName, userId)Parameters:
– masterChkShtId (int): Master check sheet ID.
– chkShtId (int): Current check sheet ID to update.
– chkShtVersionStateName (string): Target state name (e.g., Released, Draft, In Revision, Archived).
– userId (int): User ID performing the update.
Returns:
– recordsModified (int): Number of records modified.
– message (string or None): None if success; error details on failure.
Valid State Changes
The function supports these transitions and applies the corresponding actions:– None → Draft: Set version number to 1.
– Draft → Released: Add version history entry (no copy/rename).
– Released → Draft: Add version history entry (no copy/rename).
– Released → In Revision: Duplicate the check sheet, increment version number, add version history entry.
– In Revision → Released: Archive the currently released master, rename as archived, promote the in-revision sheet to released, rename it to the released name, and update master IDs for version history items.
– Archived → Released: Archive the current released master, update the existing sheet from the archived values, and increment version number.
Parameters
Parameter | Type | Required | Notes |
---|---|---|---|
masterChkShtId | int | Yes | Master ID for the check sheet group |
chkShtId | int | Yes | ID of the check sheet being transitioned |
chkShtVersionStateName | string | Yes | Target version state name (Draft, Released, In Revision, Archived) |
userId | int | Yes | User performing the update |
Code Examples
# Promote from Draft to Released
records_modified, msg = system.kanoa.quality.sheet.updateSheetVersionState(
masterChkShtId=1001,
chkShtId=2002,
chkShtVersionStateName='Released',
userId=123
)
print(records_modified, msg)
# Start a revision from Released
records_modified, msg = system.kanoa.quality.sheet.updateSheetVersionState(
masterChkShtId=1001,
chkShtId=2002,
chkShtVersionStateName='In Revision',
userId=123
)
print(records_modified, msg)
# Complete a revision: In Revision -> Released
records_modified, msg = system.kanoa.quality.sheet.updateSheetVersionState(
masterChkShtId=1001,
chkShtId=2002,
chkShtVersionStateName='Released',
userId=123
)
print(records_modified, msg)