28-06-2012 01:28 PM
Hi All,
I hope you’re all well. I’m having major issues in regards to the propagation. What should actually be happening is that the authorization levels are to be lowered for the parent (GSR Artefact) object and well as its children (e.g. Diagram) and grandchildren(Message)(there are a few exceptions in place where this will not happen) but what is actually happening now is that the parent and the children are being propagated(thanks again for help on this) but grandchildren are being ignored.
e.g. currently the parent(GSR Artefact) object and child(Diagram) objects have the authorization levels lowered successfully but the grand child(Message) does not. I’m looking at the Diagram(child) object and only need the Message and Condition grandchildren to propagate.
How can I also propagate the grandchildren?
Below is the current code I have in place (I have highlighted the code that I believe should be doing the job(please note with this code I was trying to propagate all grandchildren)).
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Function TriggerAction(mgobjAction As MegaObject, mgobjTriggeredTransition As MegaObject, mgobjCurrentStatusInstance As MegaObject)
Dim mgRoot
Dim mgWorkflowEgine
Dim mgidWorkflowExecutionUserId
Dim blnUpdatorModified
' Initializing variables
Set mgRoot = mgobjAction.GetRoot()
Set mgWorkflowEgine = mgRoot.CurrentEnvironment.GetMacro("~VBQZHHj0Az30[Workflow Engine]")
' The lines below are here if you need your code to make some changes as the workflow execution user
' This is needed in order to make changes on object for which the current user has not got the correct autorisation level
' Your macro must be created by a user having the rigth autorisation level (Administrator or the user defined as Workflow Execution User)
mgidWorkflowExecutionUserId = mgWorkflowEgine.GetWorkflowExecutionUserId(mgRoot)
blnUpdatorModified = mgRoot.SetUpdator(mgidWorkflowExecutionUserId)
Dim oWInstance as MegaObject
Set oWInstance = mgobjCurrentStatusInstance.GetCollection("~dvLwaVVv9rW2[Workflow Instance]").Item(1)
Dim oSubject as MegaObject
Set oSubject = mgRoot.GetObjectFromId(oWInstance.GetCollection("~sxLwpZVv9ju2[Subject]").Item(1).GetId)
Dim oGSR as MegaObject
Set oGSR = oSubject.GetCollection("~W7HgkwAHFfRV[GSR Artifact]").Item(1)
Dim sAuthLevel as MegaObject
sAuthLevel = oGSR.GetProp("Authorization")
Dim oMetaClass as MegaObject
Set oMetaClass = mgRoot.GetObjectFromId(oGSR.GetClassId)
Dim oMetaAssociationEnd as MegaObject
Dim oObject as MegaObject
Dim cObject as MegaObject
Dim cChildObjects as MegaObject
Dim obj as MegaObject
Dim c2Object as MegaObject
Dim c2ChildObjects as MegaObject
Dim obj2 as MegaObject
Dim sExclusions as String
Dim sLower as String
msgbox "Propagation Starting..." & vbCrLf & "Please wait for confirmation that the process has completed (this may take several minutes)" & vbCrLf & "Please click OK to continue", 32 , "Information (Lowering Authorization Levels)"
sExclusions = "Project,Standard,Person,External Reference"
sLower = "Message,Condition,Synchronization,Sequence Flow,Next,Previous,Loop,Identifier,Generalization,AssociationEnd (DM),Association (DM)"
For Each oMetaAssociationEnd in oMetaClass.GetCollection("~e00000008020[MetaOppositeAssociationEnd]")
For Each oObject in oGSR.GetCollection(oMetaAssociationEnd.GetProp("~Z20000000D60[Short Name]"))
If InStr(1, sExclusions, mgRoot.GetObjectFromId(oObject.GetClassId).GetProp("~Z20000000D60[Short Name]")) = 0 Then
oObject.SetProp "Authorization", sAuthLevel
End If
cChildObjects = oObject.extract
cObject = oGSR.GetSelection(cChildObjects)
' msgbox cObject
For Each cObject In oGSR.GetSelection(oMetaAssociationEnd.GetProp("~Z20000000D60[Short Name]"))
'msgbox "Child"
If InStr(2, sExclusions, mgRoot.GetObjectFromId(cObject.GetClassId).GetProp("~Z20000000D60[Short Name]")) = 0 Then
cObject.SetProp "Authorization", sAuthLevel
End If
c2ChildObjects = cObject.extract
c2Object = oGSR.GetSelection(c2ChildObjects)
For Each c2Object In oGSR.GetSelection(oMetaAssociationEnd.GetProp("~Z20000000D60[Short Name]"))
'msgbox "Grand Child"
If c2Object = Message Or Condition Then
If InStr(3, sExclusions, mgRoot.GetObjectFromId(c2Object.GetClassId).GetProp("~Z20000000D60[Short Name]")) = 0 Then
c2Object.SetProp "Authorization", sAuthLevel
End If
End If
Next
Next
Next
Next
msgbox "Authorizations successfully lowered", 32 , "Success"
' You can return an error message
TriggerAction = "Propagation Failed"
End Function
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you have any questions please do not hesitate to ask.
Thank you in advance for the advice.
Kind Regards,
Omar Niaz
Solved! Go to Solution.
05-09-2012 12:48 PM
Hi Jerome,
Apologies for the late response. The client no longer requires this to be done as they no longer require any authorization level to be lowered.
Thank you
Omar
05-07-2012 03:17 PM
Hello Omar
Is not very easy to undestand the issue.
--> Can you add a post to explain better/rephrase.:
- What you are willing to do (objective)?
- How you are doing (coding option)?