Topic
  • 4 replies
  • Latest Post - ‏2013-08-20T05:41:17Z by SravanKumarR
SravanKumarR
SravanKumarR
43 Posts

Pinned topic Retrieve Account DN based on Service name

‏2013-07-30T09:12:10Z |

Hi,

 

I want to how to retrieve Account DN based on service name in the accounts profile.

If user has three accounts and service for those accounts, lets say

Acc1 -> Serv1 , Acc2 -> Serv2 and Acc3 -> Serv3

My requirement is like as below, have to update few attributes only in one of the account, lets assume it is on Acc3.

I need to search all user's accounts based on service name(Serv3)(same on dev,test and prod environments).

Kindly help me regarding this.

  • TerryYau
    TerryYau
    24 Posts

    Re: Retrieve Account DN based on Service name

    ‏2013-07-31T01:00:31Z  

    Do a ServiceSearch.searchByName, this will give you the service object...and its DN.

    Then do an AccountSearch.searchByOwner, this will give you a list of accounts of that Person/Owner.  Iterate through the account objects until the account's serviceDN matches the DN from above...then that's your account object, and from there, you have your account DN of the service in question.

    This really assumes that the user has no more than one account per service.

    Updated on 2013-07-31T01:05:36Z at 2013-07-31T01:05:36Z by TerryYau
  • SravanKumarR
    SravanKumarR
    43 Posts

    Re: Retrieve Account DN based on Service name

    ‏2013-07-31T06:23:08Z  
    • TerryYau
    • ‏2013-07-31T01:00:31Z

    Do a ServiceSearch.searchByName, this will give you the service object...and its DN.

    Then do an AccountSearch.searchByOwner, this will give you a list of accounts of that Person/Owner.  Iterate through the account objects until the account's serviceDN matches the DN from above...then that's your account object, and from there, you have your account DN of the service in question.

    This really assumes that the user has no more than one account per service.

    Thanks Terry for your answer.

     

    Am able to get DN of service after using serviceSearch method.

    From that service object, only DN can be pulled? Is there a way to search erServiceName, erBasepoint, erURL with below commands?

    theservice=ServiceSearch.searchByName("ABCD", 2);
    Service DN = theservice[0].dn;

    Service Name = theservice[0].erServiceName;

    Service erURL= theservice[0].erURL;
     

  • TerryYau
    TerryYau
    24 Posts

    Re: Retrieve Account DN based on Service name

    ‏2013-07-31T21:43:16Z  

    Thanks Terry for your answer.

     

    Am able to get DN of service after using serviceSearch method.

    From that service object, only DN can be pulled? Is there a way to search erServiceName, erBasepoint, erURL with below commands?

    theservice=ServiceSearch.searchByName("ABCD", 2);
    Service DN = theservice[0].dn;

    Service Name = theservice[0].erServiceName;

    Service erURL= theservice[0].erURL;
     

    You can use the getProperty method on the returned object to get its attribute value(s).

  • SravanKumarR
    SravanKumarR
    43 Posts

    Re: Retrieve Account DN based on Service name

    ‏2013-08-20T05:41:17Z  
    • TerryYau
    • ‏2013-07-31T21:43:16Z

    You can use the getProperty method on the returned object to get its attribute value(s).

    Thanks.

     

    Will try and let  you know.