You need to sign in to do that
Don't have an account?
Rbn
Help on Notes and Attachments Rollup
I want all the Notes and Attachment of Contacts getting rolled up in a different custom Objects (Inline Visualforce Section).
Right now i am able to roll up the Attachments but the challenge is both notes & Attachment getting rolled up(Since we need to query on two different objects and the result is stored in two different list).
So how can i return two different lists to the page block table Section
Below is my tried Code:
VF Page:
<apex:page showHeader="false" standardController="Household_Group__c" extensions="HouseHoldntesattach" > <apex:form id="form" > <apex:pageBlock > <apex:pageBlockTable value="{!wrapper }" var="tas" id="filteredtasks" width="100%" > <apex:column > </apex:column> <apex:column > <apex:facet name="header"> <apex:outputPanel layout="inline"> Title </apex:outputPanel> </apex:facet> <apex:outputText value="{!tas.not2.Title }"> </apex:outputText><br/> <apex:outputText value="{!tas.attach2.Name}"> </apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller::
public class HouseHoldntesattach{ public List<Note> not1 {get; set;} public List<Attachment> attch1 {get; set;} public List<MyWrapper> wrapper {get; set;} string st; public Household_Group__c objhg {get;set;} public HouseHoldntesattach(ApexPages.StandardController controller) { st=System.currentPagereference().getParameters().get('id'); st = controller.getId(); objhg = (Household_Group__c )controller.getRecord(); system.debug('@@@@@@@111111'+st); list<attachment> attach = new list<attachment>(); // list<Note> not= new list<Note>(); list<Household_Member__c> Childmember = new list<Household_Member__c>(); Childmember =[select id,Member__c from Household_Member__c where Household_Group__c= :st and Incl_in_Rollup__c = true ];//HH MEMBER ID IS STORED HERE list<string> Childmemberids=new list<string>(); for(Household_Member__c HHacc:Childmember ){ Childmemberids.add(HHacc.Member__c ); } for(contact con:[select id from contact where AccountId in : Childmemberids]){ Childmemberids.add(con.id); } if(!Childmemberids.isempty()){ attch1 =[select id,name,LastModifiedDate,CreatedById from attachment where ParentId in :Childmemberids ]; not1 =[SELECT Id,LastModifiedDate,Title FROM Note where ParentId in :Childmemberids ]; wrapper = new List<MyWrapper>() ; // wrapper.add(new MyWrapper(not1 , attch1 )) ; } } public class MyWrapper { public Note not2{get; set;} public Attachment attach2{get; set;} public MyWrapper(Note not1 , Attachment attch1 ) { not2= not1 ; attach2= attch1 ; } } }
Thanks in Advance
And take page bock section inside your page block ..Take 2 page block
sections one for attachment and other for notes . And inside that use repeat
to iterate your list .
Other thing I noticed is why you are taking wrapper class . I guess without taking
that also you can get your expected result