You need to sign in to do that
Don't have an account?
sfdc007
List has no rows assignment to s object error
Hi,
I am getting the following error in my vf page , its an inline vf page which captures the old status value and the new changed status value from team form__c object
i have enabled the field history trakcing for that field where i am quering from team form history object
let me know what i am doing wrong here
MY VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" >
<apex:pageblockSection collapsible="true" showHeader="false" columns="3" >
<apex:outputText style="font-weight:700" value="Initial sub-status :{!gpsTeamForm.OldValue}"/>
<apex:outputText style="font-weight:700" value="New Sub-status :"/>
<apex:outputText style="font-weight:700" value="CycleTime :"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
My controller :
public class CycleTimeSubstatusCalulation{
public Team_Form__History gpsTeamForm {get;set;}
//public Team_Form__c gpsTeamForms;
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
//gpsTeamForms= (Team_Form__c)controller.getRecord();
gpsTeamForm =[SELECT Id ,CreatedDate,Field,NewValue,OldValue,ParentId FROM Team_Form__History WHERE Id = :ApexPages.currentPage().getParameters().get('id') and Field = 'SubStatus__c'];
}
}
Kindly help me pls , i am struck
Thanks in Advance
I am getting the following error in my vf page , its an inline vf page which captures the old status value and the new changed status value from team form__c object
i have enabled the field history trakcing for that field where i am quering from team form history object
let me know what i am doing wrong here
MY VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" >
<apex:pageblockSection collapsible="true" showHeader="false" columns="3" >
<apex:outputText style="font-weight:700" value="Initial sub-status :{!gpsTeamForm.OldValue}"/>
<apex:outputText style="font-weight:700" value="New Sub-status :"/>
<apex:outputText style="font-weight:700" value="CycleTime :"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
My controller :
public class CycleTimeSubstatusCalulation{
public Team_Form__History gpsTeamForm {get;set;}
//public Team_Form__c gpsTeamForms;
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
//gpsTeamForms= (Team_Form__c)controller.getRecord();
gpsTeamForm =[SELECT Id ,CreatedDate,Field,NewValue,OldValue,ParentId FROM Team_Form__History WHERE Id = :ApexPages.currentPage().getParameters().get('id') and Field = 'SubStatus__c'];
}
}
Kindly help me pls , i am struck
Thanks in Advance
Let me know if there are further problems.
Bye
All Answers
You're quering for the Id field.
Instead, query for ParentId field.
Tip: use the getRecord() method.
Bye
Use Below Code for your constructor:
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
list<Team_Form__History > tempList = [SELECT Id ,CreatedDate,Field,NewValue,OldValue,ParentId FROM Team_Form__History WHERE Id = :ApexPages.currentPage().getParameters().get('id') and Field = 'SubStatus__c'];
if(tempList .size()>0)
gpsTeamForm = tempList[0];
else
gpsTeamForm = new Team_Form__History();
}
Thanks
Nitin
how do i refer it in VF PAGE , by the below way
<apex:outputText style="font-weight:700" value="New Sub-status : {!gpsTeamForm.NewValue}"/>
I am getting this error
[Error] Error: Unknown property 'Team_Form__cStandardController.gpsTeamForm'
Paste this complete code,
public class CycleTimeSubstatusCalulation{
public Team_Form__History gpsTeamForm {get;set;}
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
list<Team_Form__History > tempList = [SELECT Id ,CreatedDate,Field,NewValue,OldValue,ParentId FROM Team_Form__History WHERE Id = :ApexPages.currentPage().getParameters().get('id') and Field = 'SubStatus__c'];
if(tempList .size()>0)
gpsTeamForm = tempList[0];
else
gpsTeamForm = new Team_Form__History();
}
}
<apex:outputText style="font-weight:700" value="Initial sub-status :{!tempList.OldValue}"/>
i am getting the following error
Error: Unknown property 'Team_Form__cStandardController.tempList
Page:
Class:
Please dont make any changes in the page, the starting vf page was correct .Just try and save the previous one only.
Here is the previous page
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" >
<apex:pageblockSection collapsible="true" showHeader="false" columns="3" >
<apex:outputText style="font-weight:700" value="Initial sub-status :{!gpsTeamForm.OldValue}"/>
<apex:outputText style="font-weight:700" value="New Sub-status :"/>
<apex:outputText style="font-weight:700" value="CycleTime :"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
1) when i change the value of sub status is is updating correctly with the old value and new value correspondinly , but when i change it for the second time it is not getting updated again
2) secondly right now we are making changes to one field which is not capturing the history , i want to capture the complete history of sub status change in my vf page
Help me pls
VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" >
<apex:pageblockSection collapsible="true" showHeader="false" columns="3" >
<apex:outputText style="font-weight:700" value="Initial sub-status :{!gpsTeamForm .OldValue}"/>
<apex:outputText style="font-weight:700" value="New Sub-status :{!gpsTeamForm .NewValue}"/>
<apex:outputText style="font-weight:700" value="CycleTime :"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
CONTROLLER :
public class CycleTimeSubstatusCalulation{
public Team_Form__History gpsTeamForm {get;set;}
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
Team_Form__c tf = (Team_Form__c) controller.getRecord();
list<Team_Form__History > tempList = [SELECT Id, CreatedDate, Field, NewValue, OldValue, ParentId
FROM Team_Form__History
WHERE ParentId = :tf.Id
AND Field = 'SubStatus__c'];
if(tempList .size()>0)
gpsTeamForm = tempList[0];
else
gpsTeamForm = new Team_Form__History();
}
}
Kindly help me on this regard
Thanks in Advance
1. Every time you change the value of a tracked field, the system create a new history record. The page shows always the first record of the query result (gpsTeamForm = tempList[0];). Try to order the query, adding this code at the end of the query: "ORDER BY CreatedDate DESC".
2. If you want see all the history you must change the structure of your page and class, because you have to handle a list of record.
Here an example of what do you want.
PAGE: CONTROLLER:
Let me know eventually errors, because I had no time to try this code before.
I hope it helps you.
Bye
1) My requirement is i also want to calculate the time change between old sub status and new substatus and display the value
the calculated time should be DD:HH:MM format
it should skip for following
When Sub-Status=‘With Customer’
For weekends (Saturday and Sunday)
December 24th, 25th and 26th
January 1st.
Help me how to achieve thhis in my apex class
below is my code
VF PAGE :
<apex:page standardController="Team_Form__c" extensions="CycleTimeSubstatusCalulation" tabStyle="Team_Form__c" sidebar="false" showHeader="false">
<apex:form >
<apex:pageblock title="EMEA SaSu Cycle-Time" mode="inlineEdit" >
<apex:pageBlockTable value="{!gpsTeamForm}" var="gps">
<apex:column headervalue="Initial sub-status :" value="{!gps.OldValue}"/>
<apex:column headervalue="New sub-status :" value="{!gps.NewValue}"/>
<apex:column headervalue="Cycle Time :" />
</apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>
APEX CLASS :
public class CycleTimeSubstatusCalulation{
public List<Team_Form__History> gpsTeamForm {get;set;}
public CycleTimeSubstatusCalulation(ApexPages.StandardController controller) {
gpsTeamForm = new List<Team_Form__History>();
list<Team_Form__History > tempList = new list<Team_Form__History >();
Team_Form__c tf = (Team_Form__c) controller.getRecord();
tempList = [SELECT Id, CreatedDate, Field, NewValue, OldValue, ParentId
FROM Team_Form__History
WHERE ParentId = :tf.Id
AND Field = 'SubStatus__c'];
if(tempList .size()>0)
for(integer i=0; i<tempList.size(); i++ )
{
gpsTeamForm.add(tempList[i]);
}
//gpsTeamForm = tempList[0];
else
gpsTeamForm = new List<Team_Form__History>();
}
}
Kindly help me in this regard
thanks in advance
sorry for the delay, but I'm very busy at the moment.
Try to read this example. It gives you the time diff with the requested format, but doesn't skip weedends and holidays (sorry, but it's not so simple and I would need more time).
CONTROLLER:
PAGE:
To skip the holidays I suggest you to use the standard object Holiday.
You can configure holidays right here: Setup --> Company Profile --> Holidays
I hope I was helpful.
Bye
I am getting the following error
Error: Compile Error: Variable does not exist: ctrl at line 18 column 9
ctrl.addFields(new List<String>{'SubStatus__c','CreatedDate'});
should that be
public String ctrl{get;private set;}
am i right
Replace ctrl with controller, or copy and paste all the code as I shared with you.
Bye
can you tell me what shoulkd i replace ctrl with ?
Let me know if there are further problems.
Bye
Existing Referred 0:0:-13
Referred ILEC Request - No RPCM Involvement 0:-3:-37
<apex:column headervalue="Cycle Time " value="{!gps.timeDiff}"/>
or
<apex:column headervalue="Cycle Time " value="{!gps.CreatedDate}"/>
Replace only the 37 line with this: getFormattedDiff(tfList[i-1].CreatedDate,tfList[i].CreatedDate)
You must refer the first:
<apex:column headervalue="Cycle Time " value="{!gps.timeDiff}"/>
I hope it's all ok now.
Bye