Topic
  • 4 replies
  • Latest Post - ‏2013-09-03T05:39:51Z by franzw
jdell
jdell
105 Posts

Pinned topic ITIM 5.1: Workflow script - retrieve container name

‏2013-09-02T06:22:29Z |

Hello,

I need to modify an existing account operational workflow (changePassword operation for TAM).  As part of the modification, I need the container name (from the TIM org structure) that the owner of the account belongs to.  I borrowed the following code from an IBM redbook:

var acct = Entity.get();
var acctOwnerDN = acct.getProperty("owner")[0];
var acctOwnerFilter = acctOwnerDN.substring(0,30);

var ps = new PersonSearch();
var user = ps.searchByFilter("Person", "(" + acctOwnerFilter + ")", 2);

var containerDN = user[0].getProperty("erparent")[0];
var containerFilter = containerDN.substring(0, 30);

Enrole.log("script", "CONTAINER FILTER = " + containerFilter);
var cs = new ContainerSearch();
var container = cs.searchByFilter("AdminDomain", "(" + containerFilter + ")", 2);
Enrole.log("script", "CONTAINER NAME = " + container[0].getProperty("ou")[0]);
 

When I execute a change password operation, the last line throws an error "container[0] is undefined".  I have confirmed that the container filter is correct, so I can only assume that the Container.searchByFilter() method call is failing.  I'm not sure what to pass in as the first parameter (profile name).  I have tried "AdminDomain" as shown above, I have tried "Admin Domain", "Location", "Container" - all to no avail.

If anyone can shed some light on what I'm doing wrong here it would be appreciated.

Cheers,

JD

  • franzw
    franzw
    395 Posts
    ACCEPTED ANSWER

    Re: ITIM 5.1: Workflow script - retrieve container name

    ‏2013-09-02T06:57:22Z  

    A couple of comments....

    It is not good practice to make the ITIM OU tree equal to the Company OU tree - ITIM tree should reflect the security and policies within ITIM - not the company OU. I must say this is very common mistake as this was how the original product was thought - but none the less a very bad idea.

    You script is overly complicated - to get the owner of an account this is how :

    myOwner = new Person(Entity.get().getProperty("owner")[0]);

    Similarly for getting the owner container :

    myOwnerContainerName = myOwner.getproperty("erparent")[0].name;

    Now - the problem is that your container can be of any type - so you may need some extra code if you want to use the the container for something...

    Study the DirectoryObject Javascript reference - there is a lot of information in there if you can decipher the hints :-) : http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/topic/com.ibm.isim.doc_6.0/reference/ref/ref_ic_javext_dirobj.htm

    HTH

    Regards

  • franzw
    franzw
    395 Posts

    Re: ITIM 5.1: Workflow script - retrieve container name

    ‏2013-09-02T06:57:22Z  

    A couple of comments....

    It is not good practice to make the ITIM OU tree equal to the Company OU tree - ITIM tree should reflect the security and policies within ITIM - not the company OU. I must say this is very common mistake as this was how the original product was thought - but none the less a very bad idea.

    You script is overly complicated - to get the owner of an account this is how :

    myOwner = new Person(Entity.get().getProperty("owner")[0]);

    Similarly for getting the owner container :

    myOwnerContainerName = myOwner.getproperty("erparent")[0].name;

    Now - the problem is that your container can be of any type - so you may need some extra code if you want to use the the container for something...

    Study the DirectoryObject Javascript reference - there is a lot of information in there if you can decipher the hints :-) : http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/topic/com.ibm.isim.doc_6.0/reference/ref/ref_ic_javext_dirobj.htm

    HTH

    Regards

  • jdell
    jdell
    105 Posts

    Re: ITIM 5.1: Workflow script - retrieve container name

    ‏2013-09-03T01:51:02Z  
    • franzw
    • ‏2013-09-02T06:57:22Z

    A couple of comments....

    It is not good practice to make the ITIM OU tree equal to the Company OU tree - ITIM tree should reflect the security and policies within ITIM - not the company OU. I must say this is very common mistake as this was how the original product was thought - but none the less a very bad idea.

    You script is overly complicated - to get the owner of an account this is how :

    myOwner = new Person(Entity.get().getProperty("owner")[0]);

    Similarly for getting the owner container :

    myOwnerContainerName = myOwner.getproperty("erparent")[0].name;

    Now - the problem is that your container can be of any type - so you may need some extra code if you want to use the the container for something...

    Study the DirectoryObject Javascript reference - there is a lot of information in there if you can decipher the hints :-) : http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/topic/com.ibm.isim.doc_6.0/reference/ref/ref_ic_javext_dirobj.htm

    HTH

    Regards

    Hi Franz,

    Thanks for your reply.  First up, I'm not using the ITIM OU tree to reflect our company structure.  If I did this we would have the most complicated ITIM OU structure going around.  We only have a handfil of ITIM OUs (5 in fact) and these have been set up to reflect our policies on security and administration within ITIM.

    At the moment, I'm just trying to get the container name to print to the logs - here's the code:

    myOwner = new Person(Entity.get().getProperty("owner")[0]);
    myOwnerContainerName = myOwner.getProperty("erparent")[0].name;
    Enrole.log("script", "CONTAINER NAME ==> " + myOwnerContainerName);

    The container name is not being written to the logs - I just get "CONTAINER NAME ==> " as output.  The logical name of the container resides in the "ou" attribute - does the 'name' property inherently know this or do we have to do something else for this to work?

    Regards,

    JD

  • jdell
    jdell
    105 Posts

    Re: ITIM 5.1: Workflow script - retrieve container name

    ‏2013-09-03T04:44:38Z  
    • franzw
    • ‏2013-09-02T06:57:22Z

    A couple of comments....

    It is not good practice to make the ITIM OU tree equal to the Company OU tree - ITIM tree should reflect the security and policies within ITIM - not the company OU. I must say this is very common mistake as this was how the original product was thought - but none the less a very bad idea.

    You script is overly complicated - to get the owner of an account this is how :

    myOwner = new Person(Entity.get().getProperty("owner")[0]);

    Similarly for getting the owner container :

    myOwnerContainerName = myOwner.getproperty("erparent")[0].name;

    Now - the problem is that your container can be of any type - so you may need some extra code if you want to use the the container for something...

    Study the DirectoryObject Javascript reference - there is a lot of information in there if you can decipher the hints :-) : http://pic.dhe.ibm.com/infocenter/tivihelp/v2r1/topic/com.ibm.isim.doc_6.0/reference/ref/ref_ic_javext_dirobj.htm

    HTH

    Regards

    Hi Franz,

    Found the answer to my issue - the line of code retrieving the propery "erparent", should be retrieveing the relationship "parent".

    Thanks again for your help - your code is surely more efficient than my convoluted mess.

    Regards,

    JD

  • franzw
    franzw
    395 Posts

    Re: ITIM 5.1: Workflow script - retrieve container name

    ‏2013-09-03T05:39:51Z  
    • jdell
    • ‏2013-09-03T04:44:38Z

    Hi Franz,

    Found the answer to my issue - the line of code retrieving the propery "erparent", should be retrieveing the relationship "parent".

    Thanks again for your help - your code is surely more efficient than my convoluted mess.

    Regards,

    JD

    Good to know that you have done it right :-)

    Just to explain - the erparent of a person is the ITIM container where the person resides - I do not understand why it did not print the name of that container - but sometimes the ITIM model is not working fully as you would expect.

    Regards

    Franz Wolfhagen