1

I have co-owner field in account I am populating user id of other user . So basically It like sharing.

My scenario is I have a table where accounts are populated.

My req is I need to get allaccounts that are shared using co-owner field.

Iam struggling to get related account of that account based on co-owner field

 <apex:repeat value="{!ListCallplanWrapper}"  var="acnt" >
<apex:pageBlockTable value="{!acnt}">

<apex:pageblockTable value="{!also}" var="also">

<apex:column value="{!also.name}"/>



</apex:pageblockTable>

</apex:pageBlockTable>
</apex:repeat>

My controller is

Public list<Account> getalso()

{
aid = Apexpages.currentPage().getParameters().get('id');
Account acc = [Select id,name,Ownerid ,Co_Owner__c from account where id =:aid];
String s='%' + acc.name+'%';
String str = acc.Co_Owner__c;
List<String> sArr = str.split(';', 0);
list<account> acclist = [Select name,OwnerId,Territory_Name__c,Total_Calls_Formula__c ,( select id,name,Original_CallString__c,Updated_CallString__c,Call_String_Status__c from Call_Strings__r)from account where ownerid!= :acc.Ownerid and name like :s and OwnerId in :sArr ];
return acclist ;
}
2
  • If you want to know which are shared with the co-owner field, why wouldn't you search for Co_Owner__c == null or blank? Your current SOQL is searching for Accounts owned by the co-owners of a different Account.
    – Mike Chale
    Jun 17, 2013 at 15:23
  • Couple of things, are you storing IDs as strings in Co_Owner__c as per your other post? If so, I think your syntax is wrong for split (see salesforce.stackexchange.com/questions/12856/…). Also, I notice you are not accepting the answers that people are giving to your questions. Is this because they are wrong? I would recommending some answers to get a better response. Jun 17, 2013 at 16:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.