system.kanoa.sheet.updateSheetVersionState(masterChkShtId, chkShtId, chkShtVersionStateName, userId)
This function updates the chkShtId version state i.e. to 'Released'. It handles the logic of creating copies, archiving, renaming etc. Valid state changes are...
- None to 'Draft': Set ver # to 1
- 'Draft' to 'Released': Do nothing
- 'Released' to 'Draft': Do nothing
- 'Released' to 'In Revision': Duplicate checksheet. Increment ver #
- 'In Revision' to 'Released': Archive current released master, update master Ids to 'In Revision' chkShtId and set state to 'Release'
- 'Archived' to 'Released': Archive current released master, update existing checksheet to values from archived checksheet, increment ver #
Parameters
masterChkShtId Integer: Id of master check sheet
chkShtId Integer: Id of check sheet
chkShtVersionStateName String: i.e. 'Released'
userId Integer: Id of user executing the function
Returns
# of records modified Integer
message String None if success
Example
# Complete a revision: In Revision -> Released
masterChkShtId=1001
chkShtId=1004
chkShtVersionStateName='Released'
userId=5
retVal, msg = system.kanoa.quality.sheet.updateSheetVersionState(masterChkShtId, chkShtId, chkShtVersionStateName, userId)