Forum Discussion
Select Case args.OperationName
Case Is = BREventOperationType.DataQuality.Certify.SaveCertifyState
If args.IsBeforeEvent = False Then
'go get the certify/uncertify event and WF info
Dim wfUnitClust As WorkflowUnitPk = DirectCast(args.Inputs(1), WorkflowUnitPk)
If BRApi.Workflow.Metadata.GetProfile(si, wfUnitClust.ProfileKey).Name.XFEqualsIgnoreCase(""Some Workflow Name"") Then
Dim certifyInstance As CertifySignOffInstanceInfo = DirectCast(args.Inputs(2), CertifySignOffInstanceInfo)
'get the sign off state ""120"" = Certified
Dim signOffState As Integer = certifyInstance.SignOffState
If Not certifyInstance Is Nothing Then
'if a user is trying to uncertify
If signOffState <> 120 Then
'call out a specific user to block an uncertify event for
If certifyInstance.UserName.XFEqualsIgnoreCase(""nkroppe"") Then
Throw New XFException(si, New Exception(""Error: Unable to uncertify workflow.""))
End If
End If
End If
End If
End If
End Select
in your example, instead of blocking a specific user, could you block a user group?
Yes, you totally could! I don't have the code on hand, but you could use the brapi.Security.Authorization.IsUserInGroup(si, groupID) function to test if the user who executed the uncertifcation action is in a specific group.