Forum Discussion
Hi Khanh
I just implemented something similar. You will need a Business Rule of type Wcf Event Handler
Then the code is something like:
Try
' OneStream provides the lines below
Dim returnValue As Object = args.DefaultReturnValue
args.UseReturnValueFromBusinessRule = False
args.Cancel = False
' before consol starts
If ( args.IsBeforeEvent And (args.WcfServiceType = WcfServiceType.Calculate Or args.OperationName= "StartConsolidation" Or args.OperationName= "StartProcessCube") )
' check if user is in security group OK_CONSOL if he is not then cancel running
If ( Not brapi.Security.Authorization.IsUserInGroup(si,"OK_CONSOL")) Then
args.Cancel = True
' throw in an exception to grab their attention
Throw New XFException(si, New Exception("SOX Violation: User NOT Provisioned to Execute Consolidation."))
End If
End If
Return returnValue
- halbrooks1003 years agoNew Contributor III
Do you create this as a new business rule? and where does it get stored?
- StigThronaes12 days agoNew Contributor
Hi! I have tried this code but it seems it also restricts the user from running "standard" consolidate and also calculate and translate. How can I modify the code so it only restricts "Force Consolidate"?
- Oscar12 days agoContributor
the following will tell you if it's force consolidate:
Dim isForced As Boolean = args.inputs(2)Then add to your nested code as required:
If( isForced )
.....
Else
.....
End If- StigThronaes12 days agoNew Contributor
Thanks! It worked. However, it created another problem. I am no longer able to open the Task Scheduler (Business rule error). Is this a known issue? Once I deleted the wcfEventHandler business rule the Task Scheduler worked as normal again.
Related Content
- 2 years ago