You need to sign in to do that
Don't have an account?
Angela Schloeder
IsChild = False
A freelance developer left me hanging by not finishing the job. I really need to have this page not include all of the IsChild Events. Most every Event created in our org has invitees, but this makes it very difficult to know which is the parent on this vf page.
This is what I have so far. really hoping someone can help.
<apex:page controller="MeetingBacklogController" tabStyle="Event">
<apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
<apex:form id="form">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton rendered="{!events.size>0}" value="Save" action="{!save}" reRender="form" status="status" />
<apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
<apex:actionStatus startText="Updating..." id="status" />
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageMessage severity="info" rendered="{!events.size=0}">
No records found
</apex:pageMessage>
<apex:pageBlockTable rendered="{!events.size>0}" value="{!events}" var="event">
<apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" value="{!event.Attendee__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}" value="{!event.Meeting_Progression__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Client_Invite__c.Label}">
<apex:inputField value="{!event.Client_Invite__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invite__c.Label}">
<apex:inputField value="{!event.Exec_Invite__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Accepted__c.Label}">
<apex:inputField value="{!event.Exec_Accepted__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Tentative__c.Label}">
<apex:inputField value="{!event.Exec_Tentative__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
<apex:inputField value="{!event.Meeting_Status__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" value="{!event.Location}" />
<apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}" value="{!event.StartDateTime}" />
<apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
<apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
<apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
This is what I have so far. really hoping someone can help.
<apex:page controller="MeetingBacklogController" tabStyle="Event">
<apex:sectionHeader title="Event" subtitle="Meeting Backlog" />
<apex:form id="form">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton rendered="{!events.size>0}" value="Save" action="{!save}" reRender="form" status="status" />
<apex:commandButton value="Refresh" action="{!refresh}" reRender="form" status="status" />
<apex:actionStatus startText="Updating..." id="status" />
</apex:pageBlockButtons>
<apex:pageMessages />
<apex:pageMessage severity="info" rendered="{!events.size=0}">
No records found
</apex:pageMessage>
<apex:pageBlockTable rendered="{!events.size>0}" value="{!events}" var="event">
<apex:column headerValue="{!$ObjectType.Event.fields.Set_By__c.Label}" value="{!event.Set_By__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Attendee__c.Label}" value="{!event.Attendee__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Progression__c.Label}" value="{!event.Meeting_Progression__c}" />
<apex:column headerValue="{!$ObjectType.Event.fields.Client_Invite__c.Label}">
<apex:inputField value="{!event.Client_Invite__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Invite__c.Label}">
<apex:inputField value="{!event.Exec_Invite__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Accepted__c.Label}">
<apex:inputField value="{!event.Exec_Accepted__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Exec_Tentative__c.Label}">
<apex:inputField value="{!event.Exec_Tentative__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Meeting_Status__c.Label}">
<apex:inputField value="{!event.Meeting_Status__c}" />
</apex:column>
<apex:column headerValue="{!$ObjectType.Event.fields.Location.Label}" value="{!event.Location}" />
<apex:column headerValue="{!$ObjectType.Event.fields.StartDateTime.Label}" value="{!event.StartDateTime}" />
<apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}" value="{!event.AccountId}" />
<apex:column headerValue="{!$ObjectType.Contact.fields.Name.Label}" value="{!event.WhoId}" />
<apex:column headerValue="{!$ObjectType.Contact.fields.Title.Label}" value="{!relatedRecords[event.WhoId]['Title']}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
There were some mistakes in the code, I have corrected them and updated the class and the Visualforce Page, as needed by you.
I have handled duplicate Events and now the Child Events are not shown on the Page.
Please find below the Class and the Visualforce Page:
Apex Class:
Visualforce Page:
Please let me know if this helps.
If yes, please mark the Question as Solved.
Thanks and Regards,
Anirudh Singh
All Answers
To help you, I will need the below answers:
Please can you let me know what is the actual requirement along with the details and which functionality is this Visualforce Page developed to achieve?
Also, where is it used like on clicking a button on some Record page this Visualforce Page gets opened.
Please provide the controller MeetingBacklogController for this Visualforce Page.
Thanks and Regards,
Anirudh Singh
Thank you again for looking at this.
A link in the sidebar opens the vf page with a list of open meetings that can be updated from the page. See below:
Problem is the duplicate, (Child) meetings. We have no way of knowing which is the Parent and that is the only one that can actually be updated and saved. And the boss does not want to have to see all child events and figure out which is which. Would like to filter out all Child Events.
Apex Class
MeetingBacklogController
public with sharing class MeetingBacklogController {
public Event[] events { get; set; }
public Map<Id, SObject> relatedRecords { get; set; }
Event[] origEvents;
public void refresh() {
init(true);
}
void init(Boolean updateUI) {
Set<String> meetingProgressionValues = new Set<String>();
for(PicklistEntry entry: Event.Meeting_Progression__c.getDescribe().getPicklistValues()) {
if(entry.getValue().startsWithIgnoreCase('M') || entry.getValue().startsWithIgnoreCase('Conf')) {
meetingProgressionValues.add(entry.getValue());
}
}
relatedRecords = new Map<Id, SObject>();
origEvents = [SELECT Set_By__c, Attendee__c, Meeting_Progression__c, Client_Invite__c,
Exec_Invite__c, Exec_Accepted__c, Exec_Tentative__c, Meeting_Status__c,
ActivityDate, StartDateTime, AccountId, Account.Name, WhoId, Who.Name, Who.Title,
Location
FROM Event
WHERE StartDateTime = NEXT_N_DAYS:90 AND
Meeting_Progression__c IN :meetingProgressionValues AND
Meeting_Status__c NOT IN ('CP','CC','MP','MC','AM')
];
for(Event record: origEvents) {
relatedRecords.put(record.WhoId, null);
}
relatedRecords.putAll([SELECT Title FROM Lead WHERE Id IN :relatedRecords.keySet()]);
relatedRecords.putAll([SELECT Title FROM Contact WHERE Id IN :relatedRecords.keySet()]);
relatedRecords.put(null, new Contact());
if(updateUI) {
events = origEvents.deepClone(true, true, true);
}
}
public MeetingBacklogController() {
init(true);
}
public void save() {
Event[] updates = new Event[0];
for(Integer index = 0; index < origEvents.size(); index++) {
if(origEvents[index] != events[index]) {
updates.add(events[index]);
}
}
Boolean updateUI = true;
try {
for(Database.SaveResult result: Database.update(events, false)) {
updateUI &= result.isSuccess();
}
init(updateUI);
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, updates.size().format()+' record'+(updates.size()==1?'':'s')+' saved.'));
} catch(Exception e) {
ApexPages.addMessages(e);
}
}
}
There were some mistakes in the code, I have corrected them and updated the class and the Visualforce Page, as needed by you.
I have handled duplicate Events and now the Child Events are not shown on the Page.
Please find below the Class and the Visualforce Page:
Apex Class:
Visualforce Page:
Please let me know if this helps.
If yes, please mark the Question as Solved.
Thanks and Regards,
Anirudh Singh
Thank you for all of what you have done here.
Everything is working except when I try to change the 'Meeting Status' to CC,MC,CP,MP OR AM; 0 records saved. No records found.
Any ideas?
Thanks and Regards,
Angela
Sorry I saw this today, I will see what is wrong and reply you back. If the issue is already solved do let me know.
Thanks and Regards,
Anirudh Singh
I have found the reason, why you are not able to see any records for 'Meeting Status' to CC,MC,CP,MP OR AM.
This is because, the events that are fetched using SOQL Query are only with Meeting_Status__c NOT IN ('CP','CC','MP','MC','AM').
So, when you update the meeting status, the updated records are not fetched as they do not meet the criteria i.e. Meeting_Status__c NOT IN ('CP','CC','MP','MC','AM').
Please see the below query that has been used in the code(I have marked it in bold): This condition is restricting the meetings to be displayed only for Meeting Status not equal to 'CP' or 'CC' or 'MP' or 'MC' or 'AM'.
If you want to see all the meeting irrespective of the status and update them on the page, please remove the condition.
Like this:
Please let me know if this helps.
Thanks and Regards,
Anirudh Singh
Are you using the same code which I gave or some modifications have been made on top of that?
Regarding the Saving of the records with the 'Meeting Status' of 'CP','CC','MP','MC' or 'AM', I am sure that in the Save method, there is no condition that prevents the records from getting saved with these meeting statuses.
Regarding the inline edit, I am not sure which inline edit you are referring here, as here we have used input fields.
Please can you provide the latest code being used for Visualforce Page and Apex Class, so that I can see if there is anything different.
Thanks and Regards,
Anirudh Singh