Skip to main content

system.kanoa.cmms.updateImage(chkImageId, procedureStepCheckId, imageName, imageType, imageDescription, imageBytes, thumbnail, userId)

Modifies an existing image record associated with a procedure step check. Use this to replace the image/thumbnail byte data or correct the name, type, or description metadata on an image that was previously added via addImage, without creating a new image record.


Parameters

chkImageId Integer: Id of image to update
procedureStepCheckId Integer: Id of the procedureStepCheckId
imageName String: Name of image
imageType String: Type of image
imageDescription String: Description of image
imageBytes byteArray: The image in byteArray format
thumbnail byteArray: Thumbnail of image in byteArray format
userId Integer:Id of the user executing the function


Returns

# of rows modified Integer
msg String None if success


Example

# Replace the photo on an existing procedure step check image record
chkImageId = 8830
procedureStepCheckId = 4218
imageName = "torque-check-photo-retake.jpg"
imageType = "image/jpeg"
imageDescription = "Retaken torque wrench reading after recalibration"

imageBytes = event.source.parent.getComponent('CameraCapture').primaryImage
thumbnail = event.source.parent.getComponent('CameraCapture').thumbnailImage

userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

rowsModified, msg = system.kanoa.cmms.updateImage(chkImageId, procedureStepCheckId, imageName, imageType, imageDescription, imageBytes, thumbnail, userId)
print rowsModified, msg