Hello,
I have created a script to import business roles from a file and add them on a specific shelf on IT shop.
Contrary to the manager, I have to create each object by my own: service item, ressource, product, ressource in product, ...
Are they specific functions in the Q1IM API which I can use?
Are they some document on this API which I can read?
Moreover I meet some errors with my script...
' create business role
Dim Org As ISingleDbObject = Connection.CreateSingle("Org")
Org.PutValue("Ident_Org", Ident_Org)
Org.PutValue("ShortName", ShortName)
Org.PutValue("UID_OrgRoot", Connection.GetSingleProperty("OrgRoot", "UID_OrgRoot", "Ident_OrgRoot='ProfilMetier'"))
Org.FillPrimaryKey()
Org.Save()
' create service item
Dim AccProduct As ISingleDbObject = Connection.CreateSingle("AccProduct")
AccProduct.PutValue("Ident_AccProduct", Ident_Org)
AccProduct.PutValue("UID_AccProductGroup", Connection.GetSingleProperty("AccProductGroup", "UID_AccProductGroup", "Ident_AccProductGroup='ProfilMetier'"))
AccProduct.FillPrimaryKey()
AccProduct.Save()
' create ressource because contrary to the system roles, business roles can't be directly assigned to a shop
Dim Ressource As ISingleDbObject = Connection.CreateSingle("Ressource")
Ressource.PutValue("Ident_Ressource", Ident_Org)
Ressource.PutValue("Ident_RessourceType", "ProfilMetier")
Ressource.PutValue("IsForITShop", True)
Ressource.PutValue("UID_AccProduct", AccProduct.GetValue("UID_AccProduct"))
Ressource.PutValue("ConnectionPath", Org.GetValue("UID_Org"))
Ressource.FillPrimaryKey()
Ressource.Save()
' create IT shop product
Dim ITShopOrg As ISingleDbObject = Connection.CreateSingle("ITShopOrg")
ITShopOrg.PutValue("Ident_Org", Ident_Org)
ITShopOrg.PutValue("FullPath", "ProfilMetier\Shelf\" + Ident_Org)
ITShopOrg.FillPrimaryKey()
ITShopOrg.Save()
' link between IT shop product and ressource
Dim ITShopOrgHasRessource As ISingleDbObject = Connection.CreateSingle("ITShopOrgHasRessource")
ITShopOrgHasRessource.PutValue("UID_ITShopOrg", ITShopOrg.GetValue("UID_Org"))
ITShopOrgHasRessource.PutValue("UID_Ressource", Ressource.GetValue("UID_Ressource"))
ITShopOrgHasRessource.FillPrimaryKey()
ITShopOrgHasRessource.Save()
I meet the following error:
[810008] Could not save object IT Shop structures (...).
[810078] IT Shop structures: Minimum length of IT Shop information is 2.
Regards,
Serge