You can create a script which will lock the record when it has been marked as completed. Users will not be able to update any value on the record. When a record is completed all the controls on the form will be disabled to all users who are not a database administrator.
If you are the database administrator you can log into the record and change its
We need to create a math formula / Script to implement this feature.
In Act! go to the TOOLS menu and select IMPACT SUITE
Go to the MATH tab on the left side
Click on the [Create Formula] button
Enter "Lock when completed" as the name ( This can be different )
Select your result field ( in the screen shot below its '(none)' )
Mark the STATUS as ACTIVE
Change the RUN WHEN to only FORM OPEN
Then copy and paste this code from below into the formula area.
Click the SAVE button
NOTE - You may need to paste this code into Notepad.exe then copy from notepad into Impact Some browsers copy formatting which can cause issues with the paste.
'---------------------------------------------- ' Beginning of code '---------------------------------------------- If Me.HostFramework.Users.GetUser(Me.HostFramework.Contacts.GetMyRecord().ID).Role = Me.HostFramework.Roles.Role_Administrator Then '---------------------------------------------- ' If the current user is an 'Administrator' ' they can edit the existing record '----------------------------------------------
ELSE '---------------------------------------------- ' If the current user is NOT an 'Administrator' '---------------------------------------------- ' check the 'Completed' value of the current record If CustomSubEntity.GetFieldDescriptorByANYString("Completed",SubEntityForm.GetEntityManager).getvalue(SubEntityItem) Then
'---------------------------------------------- ' Notify the user via a message box this record cannot be edited '---------------------------------------------- Messagebox.Show("This record has been completed and cannot be edited.","Edit OFF", MessageBoxButtons.OK, MessageBoxIcon.Information)
'---------------------------------------------- ' If Completed = TRUE then disable all the controls '---------------------------------------------- For Each ctr As System.Windows.Forms.Control In SubEntityForm.Controls ctr.enabled = false Next Else '---------------------------------------------- ' If Completed = FALSE then ENABLE all the controls '---------------------------------------------- For Each ctr As System.Windows.Forms.Control In SubEntityForm.Controls ctr.enabled = true Next
End If
END IF
RETURN NOTHING '---------------------------------------------- ' End of code '----------------------------------------------