cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API: How to set Project MetaClass Project Leader Property

sunuyleb
Contributor

Hi,

 

I want to set Project MetaClass "Project Leader" property via VB script, how can i do it?

 

NOTE: hopex v2r1 version

 

Thanks,

2 Replies

Thank you, it’s working.

hsoegaard
MEGA Partner
MEGA Partner

Hi, the following code snippet is used to set the current user as project participant  on the EA Project. You need to change the business role to the Project Leader and the person.

 

Dim mgobjRole : Set mgobjRole = oRoot.GetCollection("~230000000A40[Business Role]").Item("~AV6BAZhPIjhG[Project Participant]")
If (mgobjRole.Exists) Then
If (mgobjRole.IsAvailable) Then
Dim mgobjCurrentUser : Set mgobjCurrentUser = oRoot.GetCollection("~T20000000s10[Person <System>]").Item(oRoot.CurrentEnvironment.GetCurrentUserID)
Dim mgobjPersonAssign : Set mgobjPersonAssign = Manager.Template.GetCollection("~gCr81RIpErMH[Person Assignment]").Create
mgobjPersonAssign.Getcollection("~L2000000Ca80[Assigned Person]").Add mgobjCurrentUser
mgobjPersonAssign.Getcollection("~M2000000Ce80[Business Role]").Add mgobjRole
Set mgobjPersonAssign = Nothing
End If
End If
Set mgobjRole = Nothing