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

Creating Organizational Chart Diagram using VBScript Code

simikadampatta
Trusted Contributor

Hello, I have a Java based API which populates the "Components" of any Org-Unit.

Once, the components are populated, we wish to create an Organizational Chart based on this. I am trying the following code snippet:

 

set ou = getRoot.getObjectFromId("~wqj(Ai)UV5rC[CC Transaction Banking Unit]")

set ic = ou.getCollection("description").InstanceCreator

ic.mode = 2

ic.property("~RaZ9f43UQzLC[Diagram Type]") = "~R6IrdLDG5zT1[Org-Unit - Organizational Chart]"

ic.Property("~VVyCfK6UQnGU[Initialize Diagram]") = true

ic.Property("~pTyCuL6UQ5LU[Edit Mode]") =1

set ob = ic.create

 

But I am getting two errors:

1) The last line is throwing an error: "Object required : create'

2) The code creates two objects in "Description" instead of one.

 

Version - Hopex V4CP4

Thank you.

4 Replies

Hi,

I tried this but I am getting the same error : Update impossible ('Abstract Diagram' is abstract)

*UPDATE*

I am now able to run the code by using getType. I have modified it as follows.

Dim oRoot : Set oRoot = getRoot
Dim oOrgUnit : Set oOrgUnit = oRoot.getObjectFromId("~wqj(Ai)UV5rC[CC Transaction Banking Unit]")
Dim oDiag : Set oDiag = oOrgUnit.getCollection("~HIedE)fyADy0[Description]").GetType("~KekPBSs3iS10[Diagram]").Create("Organizational Chart")
oDiag.Setprop("~PekPCSs3ii10[Nature]") = "ORGANIGRAMME"
oDiag.getCollection("~I5(Sb)h1BPm0[DiagramType]").Add oRoot.getobjectfromid("~zx2yE2)DoWCC[Organizational Chart]")
Dim oPostCreationMacro : Set oPostCreationMacro = oRoot.CurrentEnvironment.GetMacro("~Cmc0UoWd1L10[Pattern.PostCreation.Tree]")
oPostCreationMacro.DiagramPostCreationRun oDiag, oOrgUnit

 

lionel
MEGA
MEGA

Hi,

Create manually an organizational chart for one of your org-unit.
"Right Click > Explore" your org-unit.
"Right Click > Administrate > Explore metaconcept" on the "Description" folder.
"Right Click > Copy" the "Description" MetaAssociationEnd in the new window.
Paste it in your script editor --> oOrgUnit.getCollection("Paste here")
Explore the created diagram and do the same thing on the "Diagram type" folder to check that the diagram type I gave you is the correct one. 
Also check the "Nature" verifying the MetaAttributeValue linked to your diagram.

Hope that helps.

Lionel

Hi,

I tried your suggestion. But I am getting this error : Invalid ID hM0ZFjAmWfk5 on line 3.

I tried changing the line 3 in the code to 

Dim oDiag : Set oDiag = oOrgUnit.getCollection("~HIedE)fyADy0[Description]").Create("Organizational Chart")

and now I am getting the error "Update impossible ('Abstract Diagram' is abstract)"

lionel
MEGA
MEGA

Hello,

try this code :

Dim oRoot : Set oRoot = <YOU MUST DEFINE OROOT>	  
Dim oOrgUnit : Set oOrgUnit = oRoot.getObjectFromId("~wqj(Ai)UV5rC[CC Transaction Banking Unit]")
Dim oDiag : Set oDiag = oOrgUnit.getCollection("~hM0ZFjAmWfk5[Description]").Create("Organizational Chart")
oDiag.Setprop "~PekPCSs3ii10[Nature]", "ORGANIGRAMME"
oDiag.getCollection("~5300L1mGOHQC[Type de diagramme]").Add oRoot.getobjectfromid("~R6IrdLDG5zT1[Org-Unit - Organizational Chart]")
Dim oPostCreationMacro : Set oPostCreationMacro = oRoot.CurrentEnvironment.GetMacro("~Cmc0UoWd1L10[Pattern.PostCreation.Tree]")
oPostCreationMacro.DiagramPostCreationRun oDiag, oOrgUnit

Regards

Lionel