• davoski
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

All - Let me start by saying, I am relatively new to Visual Force(VF), who have used wrappers successfully in the past to display data in the grid. However this is the first time, I am trying to update some data from it. Any help or pointers would be greatly appreciated.

 

Prioblem Description - For weekly time entry project, what are we trying to do is to allow user to select a week they are trying to enter the time against. I display the list of projects in a grid based on project resource assignment and the projects that are marked as "Administration" project. If they already have time entered against some day of the week for these projects, display that, else '0'. I am using wrapper to flatten the records. I am using dataTable in VF and have the columns as InputText. For some reason when I updates the data in the grid and press "Post", the controller method doesn't have the updated data. Please review saveChanges() method in my controller and VF page to see what I might be doing wrong. The debug statements in my saveChanges() loop retains the old values that were derived in getWeeklyTimeEntries() method. What I am doing wrong?

 

P.S. In other examples that I found, users seem to declare the variable to use in dataTable as PRIVATE FINAL in order to retrieve and update. But as I derive this wrapper grid, I can't do that.

 

Wrapper Class -

public withsharingclass WeeklyTimeEntry_Wrapper {

public Id projectId {get;set;}

public String projectName {get;set;}

public Decimal sunday {get;set;}

public Decimal monday {get;set;}

public Decimal tuesday {get;set;}

public Decimal wednesday {get;set;}

public Decimal thursday {get;set;}

public Decimal friday {get;set;}

public Decimal saturday {get;set;}

}

 

Controller Class-

public class WeeklyTimeEntry_Controller {
private final User loggedInUser;
public String selectedWeek{get; set;}
public Date weekStartDate{get; set;}
public Date weekEndDate{get; set;} //WeekStartDate will be Sunday; and weekEndDate will be Saturday
public List<WeeklyTimeEntry_Wrapper> userWeeklyTime{get; set;} // The variable gets derived in getWeeklyTimeEntries() to display as Grid. Also, it is used to update changes in saveChanges().
//private final List<WeeklyTimeEntry_Wrapper> userWeeklyTime{get;set;}
public Map<String, Time_Record__c> postedProjectTimesMap; //The variable stores the time record that were retrieved for the user. It is used to compare with userWeeklyTime and determine Insert Vs. Updates.
public Id UserId, ContactId;
public String weekChanged{get; // *** setter is NOT being called ***
set {
weekChanged = value;
}
}

public WeeklyTimeEntry_Controller(ApexPages.StandardController stdController) {
this.loggedInUser= (User)stdController.getRecord();
UserId = loggedInUser.Id;
ContactId = [Select contactId From user WHERE Id = :UserId].ContactId;
weekChanged = 'TRUE';
}

public void saveChanges() {
system.debug('In saveChanges');
Decimal sunday = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0;
List<Time_Record__c> updateTimeRecordList = new List<Time_Record__c> ();
List<Time_Record__c> insertTimeRecordList = new List<Time_Record__c> ();
Time_Record__c updateTimeRecord;
Time_Record__c insertTimeRecord;


//Cycle through the list of updated TimeEntries
for(WeeklyTimeEntry_Wrapper updatedWeeklyTime2 : userWeeklyTime) {
system.debug('In updatedWeeklyTime2.projectName:'+ updatedWeeklyTime2.projectName);
system.debug('In updatedWeeklyTime2.projectId:'+ updatedWeeklyTime2.projectId);
system.debug('In updatedWeeklyTime2.sunday:'+ updatedWeeklyTime2.sunday);
system.debug('In updatedWeeklyTime2.monday:'+ updatedWeeklyTime2.monday);
}

} // End of saveChanges() method


public List<SelectOption> getWeeks() {
List<SelectOption> options = new List<SelectOption>();
// if (weekChanged == 'TRUE') {
// Get the weeks from the beginning of last year till this week and add it to SelectOption
Date startDate = date.newInstance(date.today().year()-1, 1, 1).toStartOfWeek();
Date endDate = startDate.addDays(6);
Date nextWeekStartDate = date.today().toStartOfWeek();
String pickListValue = string.valueOf(startDate) + ':' + string.valueOf(endDate);
String pickListLabel = 'Sunday, ' + string.valueOf(startDate);
options.add(new SelectOption(pickListValue, pickListLabel ));
selectedWeek = pickListValue;
Do {
startDate = endDate.addDays(1);
endDate = startDate.addDays(6);
pickListValue = string.valueOf(startDate) + ':' + string.valueOf(endDate);
pickListLabel = 'Sunday, ' + string.valueOf(startDate);
options.add(new SelectOption(pickListValue, pickListLabel ));
} While (nextWeekStartDate > startDate);
weekChanged = 'FALSE';
setWeek();
// }
return options;
}

public void setWeek() {
Integer li_splitDate;
this.selectedWeek = selectedWeek;
li_splitDate = selectedWeek.indexOf(':',0);
weekStartDate = Date.valueOf(selectedWeek.substring(0, li_splitDate));
weekEndDate = Date.valueOf(selectedWeek.substring(li_splitDate+1, selectedWeek.length()));
getWeeklyTimeEntries();
}

public List<WeeklyTimeEntry_Wrapper> getWeeklyTimeEntries() {
List<Team_Member__c> assignedProjects = [Select t.team_member__c, t.Contractor__c, t.Project__c, t.Project__r.Name, t.Project__r.Project_Status__c from Team_Member__c t Where t.Project__r.Project_Status__c IN ('Active','Complete') AND ((t.Contractor__c = :ContactId AND t.Contractor__c != null) OR (t.team_member__c = :UserId AND t.team_member__c != NULL))];
postedProjectTimesMap = new Map<String, Time_Record__c> ([Select t.Project__r.Name, t.name, t.Team_Member__c, t.Contractor__c, t.Hours__c, t.Id, t.Project__c, t.Start_Date__c from Time_Record__c t WHERE ((t.Contractor__c = :ContactId AND t.Contractor__c != null) OR (t.Team_Member__c = :UserId AND t.Team_Member__c != null))AND t.Start_Date__c >= :weekStartDate AND t.Start_Date__c <= :weekEndDate ORDER BY t.Project__r.Name, t.Start_Date__c]); //AND t.Start_Date__c >= 2011-11-17 AND t.Start_Date__c <= 2012-02-17];
String lastProjectInLoop = '';
Id lastProjectIdInLoop;
Decimal sunday = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0;
WeeklyTimeEntry_Wrapper weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
Map<String, WeeklyTimeEntry_Wrapper> weeklyTimeEntriesMap = new Map<String, WeeklyTimeEntry_Wrapper> ();
List<Time_Record__c> postedProjectTimes = postedProjectTimesMap.Values();

//Loop through posted Project Time to see if there's already entered time against it.
for (Time_Record__c postedProjectTime : postedProjectTimes) {
Date dateToCompareWithPostedTime = postedProjectTime.Start_Date__c.toStartOfWeek();
// If processing project is different than in previous iteration, add the values to the wrapper and reset the wrapper.
if (lastProjectInLoop != postedProjectTime.Project__r.Name && lastProjectInLoop != '') {
weeklyTimeEntry.projectId = lastProjectIdInLoop;
weeklyTimeEntry.projectName = lastProjectInLoop;
weeklyTimeEntry.sunday = sunday;
weeklyTimeEntry.monday = monday;
weeklyTimeEntry.tuesday = tuesday;
weeklyTimeEntry.wednesday = wednesday;
weeklyTimeEntry.thursday = thursday;
weeklyTimeEntry.friday = friday;
weeklyTimeEntry.saturday = saturday;
weeklyTimeEntriesMap.put(weeklyTimeEntry.projectId, weeklyTimeEntry);
//Reset the variables
weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
sunday = 0;
monday = 0;
tuesday = 0;
wednesday = 0;
thursday = 0;
friday = 0;
saturday = 0;
}

// Loop throgh 7 days, see which one matches "postedProjectTime.Start_Date__c" and update the weeklyTimeEntry.Day time accordingly.
for (Integer dayNumber = 1; dayNumber < 8; dayNumber++) {
if (dateToCompareWithPostedTime == postedProjectTime.Start_Date__c) {
if (dayNumber == 1) { //Sunday
sunday = postedProjectTime.hours__c;
} else if (dayNumber == 2) { //Monday
monday= postedProjectTime.hours__c;
} else if (dayNumber == 3) { //Tuesday
tuesday = postedProjectTime.hours__c;
} else if (dayNumber == 4) { //Wednesday
wednesday = postedProjectTime.hours__c;
} else if (dayNumber == 5) { //Thursday
thursday = postedProjectTime.hours__c;
} else if (dayNumber == 6) { //Friday
friday = postedProjectTime.hours__c;
} else if (dayNumber == 7) { //Saturday
saturday = postedProjectTime.hours__c;
}
}
dateToCompareWithPostedTime = dateToCompareWithPostedTime.addDays(1);
}
lastProjectInLoop = postedProjectTime.Project__r.Name;
lastProjectIdInLoop = postedProjectTime.Project__c;
}

// Get all the projects where this contact is assigned as team-member and instantiate weekly time entry for it.
for (Team_Member__c teamMemberProject : assignedProjects) {
//Check if the processing project has entry in TimeEntry map. If it does NOT, add it.
if (!weeklyTimeEntriesMap.containsKey(teamMemberProject.Project__r.Name)) {
weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
weeklyTimeEntry.projectId = teamMemberProject.Project__c;
weeklyTimeEntry.projectName = teamMemberProject.Project__r.Name;
weeklyTimeEntry.sunday = 0;
weeklyTimeEntry.monday = 0;
weeklyTimeEntry.tuesday = 0;
weeklyTimeEntry.wednesday = 0;
weeklyTimeEntry.thursday = 0;
weeklyTimeEntry.friday = 0;
weeklyTimeEntry.saturday = 0;

weeklyTimeEntriesMap.put(weeklyTimeEntry.projectId, weeklyTimeEntry);
}
}
//The list of TimeEntry is now ready, assign it to list so it can be used to retrieve the grid
userWeeklyTime = weeklyTimeEntriesMap.Values();
RETURN userWeeklyTime;

}

 

Visual Force -

<apex:page standardController="user" extensions="WeeklyTimeEntry_Controller" >

<apex:form id="tLineEntryForm">
<apex:pageBlock id="tEntryWeekSelectionPageBlock">
<apex:actionRegion >
<apex:pageBlockSection id="selectedWeek" title="Project List for {!$User.FirstName} {!$User.LastName}" columns="2" collapsible="false">
<apex:pageBlockSectionItem id="selectedWeek">
<apex:outputLabel for="selectedWeek">Week Beginning</apex:outputLabel>
<apex:panelGroup >
<apex:selectList value="{!selectedWeek}" multiselect="false" size="1" onchange="weekSelectedJS">
<apex:selectOptions value="{!Weeks}"/>
</apex:selectList>
</apex:panelGroup>
</apex:pageBlockSectionItem>
<apex:commandButton value="Go" action="{!setWeek}" rerender="timeEntrySection" >
<apex:param name="weekChanged" value="TRUE" assignTo="{!weekChanged}"/>
</apex:commandButton>
</apex:pageBlockSection>
</apex:actionRegion>

<apex:pageBlockSection id="timeEntrySection" title="Time Entry for {!$User.FirstName} {!$User.LastName} Dates Between {!weekStartDate} and {!weekEndDate}" columns="8" collapsible="false">
<apex:dataTable value="{!userWeeklyTime}" var="dtWeeklyTime" id="theTable" rowClasses="odd,even" styleClass="tableClass">

<apex:column >
<apex:facet name="header">Project</apex:facet>
<apex:facet name="footer">Total</apex:facet>
<apex:outputText value="{!dtWeeklyTime.projectName}" />
</apex:column>
<apex:column >
<apex:facet name="header">Sunday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.sunday}" disabled="FALSE"/>
</apex:column>
<apex:column >
<apex:facet name="header">Monday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.monday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Tuesday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.tuesday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Wenesday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.wednesday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Thursday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.thursday}" />
</apex:column>
<apex:column >
<apex:facet name="header">Friday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.friday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Saturday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.saturday}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
<apex:actionRegion >
<apex:commandButton value="Post" action="{!saveChanges}" rerender="timeEntrySection" immediate="false"/>
</apex:actionRegion>
</apex:pageBlock>
</apex:form>
</apex:page>

  • February 24, 2012
  • Like
  • 0

Hey all,

I am developing a solution on a sandbox, and this morning started to get timeouts when i try to save a case record that has a change in the status field. The problem is specific to an update to the status field, and throws up an error on he screen after around 2 minutes of waiting: "Your request exceeded the time limit for processing."

 

I have turned off all triggers running against the case, there are no callouts or outbound messages etc., though a large amount of workflow do run during processing.

 

Looking at the debug log it all looks rosy until the very end where the last 4 lines read:

14:49:32.584|WF_ACTIONS_END| None
14:49:32.584|CODE_UNIT_FINISHED|Workflow:Case
14:51:35.810|CODE_UNIT_FINISHED|TRIGGERS
14:51:35.810|EXECUTION_FINISHED

Notice the almost 2 minute delay in the middle there with no detail!!!!!!

 

Has anyone seen this before/have any suggestions on where to go from here?

 

Regards

David

Hi,

I received an automated email from SF that one of my CA signed certificate is going to expire. I need to know do I need to renew or create a new CA signed certificate in "Sandbox" or "Production" instance and then download the .CSR and send it to CA for signing?

Please help.
  • November 05, 2015
  • Like
  • 0

All - Let me start by saying, I am relatively new to Visual Force(VF), who have used wrappers successfully in the past to display data in the grid. However this is the first time, I am trying to update some data from it. Any help or pointers would be greatly appreciated.

 

Prioblem Description - For weekly time entry project, what are we trying to do is to allow user to select a week they are trying to enter the time against. I display the list of projects in a grid based on project resource assignment and the projects that are marked as "Administration" project. If they already have time entered against some day of the week for these projects, display that, else '0'. I am using wrapper to flatten the records. I am using dataTable in VF and have the columns as InputText. For some reason when I updates the data in the grid and press "Post", the controller method doesn't have the updated data. Please review saveChanges() method in my controller and VF page to see what I might be doing wrong. The debug statements in my saveChanges() loop retains the old values that were derived in getWeeklyTimeEntries() method. What I am doing wrong?

 

P.S. In other examples that I found, users seem to declare the variable to use in dataTable as PRIVATE FINAL in order to retrieve and update. But as I derive this wrapper grid, I can't do that.

 

Wrapper Class -

public withsharingclass WeeklyTimeEntry_Wrapper {

public Id projectId {get;set;}

public String projectName {get;set;}

public Decimal sunday {get;set;}

public Decimal monday {get;set;}

public Decimal tuesday {get;set;}

public Decimal wednesday {get;set;}

public Decimal thursday {get;set;}

public Decimal friday {get;set;}

public Decimal saturday {get;set;}

}

 

Controller Class-

public class WeeklyTimeEntry_Controller {
private final User loggedInUser;
public String selectedWeek{get; set;}
public Date weekStartDate{get; set;}
public Date weekEndDate{get; set;} //WeekStartDate will be Sunday; and weekEndDate will be Saturday
public List<WeeklyTimeEntry_Wrapper> userWeeklyTime{get; set;} // The variable gets derived in getWeeklyTimeEntries() to display as Grid. Also, it is used to update changes in saveChanges().
//private final List<WeeklyTimeEntry_Wrapper> userWeeklyTime{get;set;}
public Map<String, Time_Record__c> postedProjectTimesMap; //The variable stores the time record that were retrieved for the user. It is used to compare with userWeeklyTime and determine Insert Vs. Updates.
public Id UserId, ContactId;
public String weekChanged{get; // *** setter is NOT being called ***
set {
weekChanged = value;
}
}

public WeeklyTimeEntry_Controller(ApexPages.StandardController stdController) {
this.loggedInUser= (User)stdController.getRecord();
UserId = loggedInUser.Id;
ContactId = [Select contactId From user WHERE Id = :UserId].ContactId;
weekChanged = 'TRUE';
}

public void saveChanges() {
system.debug('In saveChanges');
Decimal sunday = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0;
List<Time_Record__c> updateTimeRecordList = new List<Time_Record__c> ();
List<Time_Record__c> insertTimeRecordList = new List<Time_Record__c> ();
Time_Record__c updateTimeRecord;
Time_Record__c insertTimeRecord;


//Cycle through the list of updated TimeEntries
for(WeeklyTimeEntry_Wrapper updatedWeeklyTime2 : userWeeklyTime) {
system.debug('In updatedWeeklyTime2.projectName:'+ updatedWeeklyTime2.projectName);
system.debug('In updatedWeeklyTime2.projectId:'+ updatedWeeklyTime2.projectId);
system.debug('In updatedWeeklyTime2.sunday:'+ updatedWeeklyTime2.sunday);
system.debug('In updatedWeeklyTime2.monday:'+ updatedWeeklyTime2.monday);
}

} // End of saveChanges() method


public List<SelectOption> getWeeks() {
List<SelectOption> options = new List<SelectOption>();
// if (weekChanged == 'TRUE') {
// Get the weeks from the beginning of last year till this week and add it to SelectOption
Date startDate = date.newInstance(date.today().year()-1, 1, 1).toStartOfWeek();
Date endDate = startDate.addDays(6);
Date nextWeekStartDate = date.today().toStartOfWeek();
String pickListValue = string.valueOf(startDate) + ':' + string.valueOf(endDate);
String pickListLabel = 'Sunday, ' + string.valueOf(startDate);
options.add(new SelectOption(pickListValue, pickListLabel ));
selectedWeek = pickListValue;
Do {
startDate = endDate.addDays(1);
endDate = startDate.addDays(6);
pickListValue = string.valueOf(startDate) + ':' + string.valueOf(endDate);
pickListLabel = 'Sunday, ' + string.valueOf(startDate);
options.add(new SelectOption(pickListValue, pickListLabel ));
} While (nextWeekStartDate > startDate);
weekChanged = 'FALSE';
setWeek();
// }
return options;
}

public void setWeek() {
Integer li_splitDate;
this.selectedWeek = selectedWeek;
li_splitDate = selectedWeek.indexOf(':',0);
weekStartDate = Date.valueOf(selectedWeek.substring(0, li_splitDate));
weekEndDate = Date.valueOf(selectedWeek.substring(li_splitDate+1, selectedWeek.length()));
getWeeklyTimeEntries();
}

public List<WeeklyTimeEntry_Wrapper> getWeeklyTimeEntries() {
List<Team_Member__c> assignedProjects = [Select t.team_member__c, t.Contractor__c, t.Project__c, t.Project__r.Name, t.Project__r.Project_Status__c from Team_Member__c t Where t.Project__r.Project_Status__c IN ('Active','Complete') AND ((t.Contractor__c = :ContactId AND t.Contractor__c != null) OR (t.team_member__c = :UserId AND t.team_member__c != NULL))];
postedProjectTimesMap = new Map<String, Time_Record__c> ([Select t.Project__r.Name, t.name, t.Team_Member__c, t.Contractor__c, t.Hours__c, t.Id, t.Project__c, t.Start_Date__c from Time_Record__c t WHERE ((t.Contractor__c = :ContactId AND t.Contractor__c != null) OR (t.Team_Member__c = :UserId AND t.Team_Member__c != null))AND t.Start_Date__c >= :weekStartDate AND t.Start_Date__c <= :weekEndDate ORDER BY t.Project__r.Name, t.Start_Date__c]); //AND t.Start_Date__c >= 2011-11-17 AND t.Start_Date__c <= 2012-02-17];
String lastProjectInLoop = '';
Id lastProjectIdInLoop;
Decimal sunday = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0;
WeeklyTimeEntry_Wrapper weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
Map<String, WeeklyTimeEntry_Wrapper> weeklyTimeEntriesMap = new Map<String, WeeklyTimeEntry_Wrapper> ();
List<Time_Record__c> postedProjectTimes = postedProjectTimesMap.Values();

//Loop through posted Project Time to see if there's already entered time against it.
for (Time_Record__c postedProjectTime : postedProjectTimes) {
Date dateToCompareWithPostedTime = postedProjectTime.Start_Date__c.toStartOfWeek();
// If processing project is different than in previous iteration, add the values to the wrapper and reset the wrapper.
if (lastProjectInLoop != postedProjectTime.Project__r.Name && lastProjectInLoop != '') {
weeklyTimeEntry.projectId = lastProjectIdInLoop;
weeklyTimeEntry.projectName = lastProjectInLoop;
weeklyTimeEntry.sunday = sunday;
weeklyTimeEntry.monday = monday;
weeklyTimeEntry.tuesday = tuesday;
weeklyTimeEntry.wednesday = wednesday;
weeklyTimeEntry.thursday = thursday;
weeklyTimeEntry.friday = friday;
weeklyTimeEntry.saturday = saturday;
weeklyTimeEntriesMap.put(weeklyTimeEntry.projectId, weeklyTimeEntry);
//Reset the variables
weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
sunday = 0;
monday = 0;
tuesday = 0;
wednesday = 0;
thursday = 0;
friday = 0;
saturday = 0;
}

// Loop throgh 7 days, see which one matches "postedProjectTime.Start_Date__c" and update the weeklyTimeEntry.Day time accordingly.
for (Integer dayNumber = 1; dayNumber < 8; dayNumber++) {
if (dateToCompareWithPostedTime == postedProjectTime.Start_Date__c) {
if (dayNumber == 1) { //Sunday
sunday = postedProjectTime.hours__c;
} else if (dayNumber == 2) { //Monday
monday= postedProjectTime.hours__c;
} else if (dayNumber == 3) { //Tuesday
tuesday = postedProjectTime.hours__c;
} else if (dayNumber == 4) { //Wednesday
wednesday = postedProjectTime.hours__c;
} else if (dayNumber == 5) { //Thursday
thursday = postedProjectTime.hours__c;
} else if (dayNumber == 6) { //Friday
friday = postedProjectTime.hours__c;
} else if (dayNumber == 7) { //Saturday
saturday = postedProjectTime.hours__c;
}
}
dateToCompareWithPostedTime = dateToCompareWithPostedTime.addDays(1);
}
lastProjectInLoop = postedProjectTime.Project__r.Name;
lastProjectIdInLoop = postedProjectTime.Project__c;
}

// Get all the projects where this contact is assigned as team-member and instantiate weekly time entry for it.
for (Team_Member__c teamMemberProject : assignedProjects) {
//Check if the processing project has entry in TimeEntry map. If it does NOT, add it.
if (!weeklyTimeEntriesMap.containsKey(teamMemberProject.Project__r.Name)) {
weeklyTimeEntry = new WeeklyTimeEntry_Wrapper();
weeklyTimeEntry.projectId = teamMemberProject.Project__c;
weeklyTimeEntry.projectName = teamMemberProject.Project__r.Name;
weeklyTimeEntry.sunday = 0;
weeklyTimeEntry.monday = 0;
weeklyTimeEntry.tuesday = 0;
weeklyTimeEntry.wednesday = 0;
weeklyTimeEntry.thursday = 0;
weeklyTimeEntry.friday = 0;
weeklyTimeEntry.saturday = 0;

weeklyTimeEntriesMap.put(weeklyTimeEntry.projectId, weeklyTimeEntry);
}
}
//The list of TimeEntry is now ready, assign it to list so it can be used to retrieve the grid
userWeeklyTime = weeklyTimeEntriesMap.Values();
RETURN userWeeklyTime;

}

 

Visual Force -

<apex:page standardController="user" extensions="WeeklyTimeEntry_Controller" >

<apex:form id="tLineEntryForm">
<apex:pageBlock id="tEntryWeekSelectionPageBlock">
<apex:actionRegion >
<apex:pageBlockSection id="selectedWeek" title="Project List for {!$User.FirstName} {!$User.LastName}" columns="2" collapsible="false">
<apex:pageBlockSectionItem id="selectedWeek">
<apex:outputLabel for="selectedWeek">Week Beginning</apex:outputLabel>
<apex:panelGroup >
<apex:selectList value="{!selectedWeek}" multiselect="false" size="1" onchange="weekSelectedJS">
<apex:selectOptions value="{!Weeks}"/>
</apex:selectList>
</apex:panelGroup>
</apex:pageBlockSectionItem>
<apex:commandButton value="Go" action="{!setWeek}" rerender="timeEntrySection" >
<apex:param name="weekChanged" value="TRUE" assignTo="{!weekChanged}"/>
</apex:commandButton>
</apex:pageBlockSection>
</apex:actionRegion>

<apex:pageBlockSection id="timeEntrySection" title="Time Entry for {!$User.FirstName} {!$User.LastName} Dates Between {!weekStartDate} and {!weekEndDate}" columns="8" collapsible="false">
<apex:dataTable value="{!userWeeklyTime}" var="dtWeeklyTime" id="theTable" rowClasses="odd,even" styleClass="tableClass">

<apex:column >
<apex:facet name="header">Project</apex:facet>
<apex:facet name="footer">Total</apex:facet>
<apex:outputText value="{!dtWeeklyTime.projectName}" />
</apex:column>
<apex:column >
<apex:facet name="header">Sunday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.sunday}" disabled="FALSE"/>
</apex:column>
<apex:column >
<apex:facet name="header">Monday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.monday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Tuesday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.tuesday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Wenesday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.wednesday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Thursday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.thursday}" />
</apex:column>
<apex:column >
<apex:facet name="header">Friday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.friday}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Saturday</apex:facet>
<apex:inputText value="{!dtWeeklyTime.saturday}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
<apex:actionRegion >
<apex:commandButton value="Post" action="{!saveChanges}" rerender="timeEntrySection" immediate="false"/>
</apex:actionRegion>
</apex:pageBlock>
</apex:form>
</apex:page>

  • February 24, 2012
  • Like
  • 0
Using the API guide example code for one of the StrikeIron Services:

// Create the stub

strikeironIplookup.DNSSoap dns = new strikeironIplookup.DNSSoap();

// Set up the license header

dns.LicenseInfo = new strikeiron.LicenseInfo();
dns.LicenseInfo.RegisteredUser = new strikeiron.RegisteredUser();
dns.LicenseInfo.RegisteredUser.UserID = 'you@company.com';
dns.LicenseInfo.RegisteredUser.Password = 'your-password';

// Make the Web service call

strikeironIplookup.DNSInfo info = dns.DNSLookup('www.google.com');

Where strikeiron and strikeironiplookup are classes generated by the WSDL downloaded from http://ws.strikeiron.com/relauto/iplookup?WSDL.

When I plugin my StrikeIron credentials into the above, this works just fine, and the web service call is successful.

If, however, I add:

dns.GetRemainingHits();

I get the exception:
22:11:23 ERROR - Evaluation error: System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://ws.strikeiron.com:GetRemainingHitsResponse' but found 'http://schemas.xmlsoap.org/soap/envelope/:Body'
22:11:23 ERROR - Evaluation error: Class.strikeironIplookup.DNSSoap.GetRemainingHits: line 70, column 13
AnonymousBlock: line 15, column 3
22:11:23 ERROR - Evaluation error: Class.strikeironIplookup.DNSSoap.GetRemainingHits: line 70, column 13 AnonymousBlock: line 15, column 3

Line 70 refers to the line with WebServiceCallout.invoke for GetRemainingHits().

I have had similar problems with other StrikeIron WSDL GetRemaingHits(), and also for some other web services (all the Parsing Error like the above), and not all of the methods are a void return, as GetRemainingHits is, so it is not just the return type.

How Can I debug this? Any assistance you can provide is greatly appreciated.