You need to sign in to do that
Don't have an account?
Michele Toscano
System.QueryException: List has no rows for assignment for SObject Class.SampleEditPAge.<init>: line 72, column 1
Visualforce page: (Line 72 in bold below)
<apex:page standardController="Sample_Request_Account_Information__c" extensions="SampleEditPAge" tabstyle="Sample_Request_Account_Information__c" id="pg">
<apex:form id="fm">
<apex:pagemessages id="SampleNotAllowed"/> <!--07/20/16 MT-->
<apex:actionFunction name="populateData" action="{!populateData}" immediate="true" reRender="se,se1,se2">
<apex:param name="accName" assignTo="{!accName}" value=""/>
</apex:actionFunction>
<div class="bPageTitle">
<div class="ptBody">
<div class="content">
<img src="/s.gif" alt="Sample Request Header" class="pageTitleIcon" title="Sample Request Header"/>
<h1 class="pageType">Sample Request Header Edit<span class="titleSeparatingColon">:</span></h1>
<h2 class="pageDescription"> New Sample Request Header</h2><div class="blank"> </div>
</div><div class="links">
<a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&target=co_edit.htm&section=CustomObjects&language=en_US&release=198.12.4&instance=CS7%27, %27Help%27, 1024, 768, %27width=1024,height=768,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,menubar=yes,directories=no,location=yes,dependant=no%27, false, false);" title="Help for this Page (New Window)">
<span class="helpLink">Help for this Page</span>
<img src="/s.gif" alt="" class="helpIcon"/>
</a></div></div>
<div class="ptBreadcrumb">
</div></div>
<apex:pageBlock title="Sample Request Header Edit" mode="edit" id="pd">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!savesamp}"/>
<apex:commandButton value="Save & New" action="{!saveandnew}" oncomplete="gotoNewpage();" rerender="sureid,fm"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="se">
<apex:facet name="header">
<span> <h3>Customer Information</h3></span>
<span class="pbSubExtra">
<span class="requiredLegend brandTertiaryFgr">
<span class="requiredExampleOuter">
<span class="requiredExample"> </span></span>
<span class="requiredMark">*</span>
<span class="requiredText"> = Required Information</span></span></span>
</apex:facet>
<apex:outputField value="{!samObj.Status__c}" id="f10"/>
<apex:inputField value="{!Sample_Request_Account_Information__c.Requested_Ship_From_Location__c}" id="f23"></apex:inputField>
<apex:inputField value="{!samObj.Planning_Account__c}" id="f1324"></apex:inputField>
<apex:inputField value="{!samObj.Transportation_Method__c}" id="f24"></apex:inputField>
<apex:inputField value="{!samObj.Account_Name__c}" required="true" onChange="var v = (document.getElementById(this.id + '_lkid')).value; populateData(v);" id="se2"/>
<apex:inputField value="{!samObj.Transportation_Notes__c}" id="f25"></apex:inputField>
<apex:inputField value="{!samObj.Contact_Name__c}" required="true" id="f20"></apex:inputField>
<Br/>
<apex:inputHidden value="{!gotoNewPage}" id="sureid"/>
<Br/>
<!-- <apex:actionRegion> -->
<apex:inputField value="{!samObj.LCL_Address__c}" id="f122">
<apex:actionSupport event="onchange" action="{!populatelcladdress}" reRender="se"/>
</apex:inputField>
<Br/>
<!-- </apex:actionRegion>-->
<apex:inputField value="{!samObj.JDE_Order_Number__c}" id="f215"></apex:inputField>
<apex:inputcheckbox value="{!samObj.Invoice_Required__c}" id="f26"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_1__c}" id="f12"></apex:outputField>
<apex:inputcheckbox value="{!samObj.COA_Required__c}" id="f27"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_2__c}" id="f13"></apex:outputField>
<apex:inputcheckbox value="{!samObj.MSDS_Required__c}" id="f28"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_3__c}" id="f14"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Data_Sheet_Required__c}" id="fMT001"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_4__c}" id="f15"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Freight_Charge__c}" id="f248"></apex:inputcheckbox>
<Br/>
<apex:inputField value="{!samObj.Total_weight__c}" id="f21239"></apex:inputField>
<apex:outputField value="{!samObj.Account_Region__c}" id="f212"></apex:outputField>
<apex:inputField value="{!samObj.Requested_Delivery_Date__c}" id="f2549"></apex:inputField>
<apex:outputField value="{!samObj.Ship_To_Country__c}" id="f17"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_State__c}" id="f18"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_City__c}" id="f16"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_Postal_Code__c}" id="f19"></apex:outputField>
<apex:outputField value="{!samObj.Approvel_Date__c}" id="f29"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Reference_Number__c}" id="f31"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_1__c}" id="f35"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_2__c}" id="f37"></apex:inputField>
<apex:outputField value="{!samObj.CABOT_Segment__c}" id="f211"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Group__c}" id="f2112"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Senior_Approver_Name__c}" id="f2341"></apex:inputField>
<apex:inputField value="{!samObj.Opportunity_Name__c}" id="f21"></apex:inputField>
<apex:inputField value="{!samObj.Account_Manager__c}" id="f3221"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Technical_Manager__c}" id="f33"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection id="se1">
<apex:inputField value="{!samObj.Notes__c}" style="width: 900px; height: 100px" id="f22"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2" id="se2">
<apex:outputField value="{!samObj.ownerId}" id="f11" rendered="{!hasIdval}">{!$User.FirstName} {!$User.LastName}</apex:outputField>
<apex:outputField value="{!samObj.ownerId}" rendered="{!hasNotIdval}" id="usr"></apex:outputField>
<apex:outputtext value="{!samObj.OAP_Order_Number__c}" id="f39"></apex:outputtext>
<apex:outputtext value="{!samObj.OAP_URL_Link__c}" id="f30"></apex:outputtext>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script>
function gotoNewpage()
{
// window.parent.location.href = '/apex/SampleEditPAge';
if(document.getElementById('pg:fm:pd:se:sureid') !=null)
{
var vals = document.getElementById('pg:fm:pd:se:sureid').value;
if(vals == 'sure')
window.parent.location.href = '/apex/SampleEditPAge';
}
}
</script>
</apex:page>
<apex:page standardController="Sample_Request_Account_Information__c" extensions="SampleEditPAge" tabstyle="Sample_Request_Account_Information__c" id="pg">
<apex:form id="fm">
<apex:pagemessages id="SampleNotAllowed"/> <!--07/20/16 MT-->
<apex:actionFunction name="populateData" action="{!populateData}" immediate="true" reRender="se,se1,se2">
<apex:param name="accName" assignTo="{!accName}" value=""/>
</apex:actionFunction>
<div class="bPageTitle">
<div class="ptBody">
<div class="content">
<img src="/s.gif" alt="Sample Request Header" class="pageTitleIcon" title="Sample Request Header"/>
<h1 class="pageType">Sample Request Header Edit<span class="titleSeparatingColon">:</span></h1>
<h2 class="pageDescription"> New Sample Request Header</h2><div class="blank"> </div>
</div><div class="links">
<a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&target=co_edit.htm&section=CustomObjects&language=en_US&release=198.12.4&instance=CS7%27, %27Help%27, 1024, 768, %27width=1024,height=768,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,menubar=yes,directories=no,location=yes,dependant=no%27, false, false);" title="Help for this Page (New Window)">
<span class="helpLink">Help for this Page</span>
<img src="/s.gif" alt="" class="helpIcon"/>
</a></div></div>
<div class="ptBreadcrumb">
</div></div>
<apex:pageBlock title="Sample Request Header Edit" mode="edit" id="pd">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!savesamp}"/>
<apex:commandButton value="Save & New" action="{!saveandnew}" oncomplete="gotoNewpage();" rerender="sureid,fm"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="se">
<apex:facet name="header">
<span> <h3>Customer Information</h3></span>
<span class="pbSubExtra">
<span class="requiredLegend brandTertiaryFgr">
<span class="requiredExampleOuter">
<span class="requiredExample"> </span></span>
<span class="requiredMark">*</span>
<span class="requiredText"> = Required Information</span></span></span>
</apex:facet>
<apex:outputField value="{!samObj.Status__c}" id="f10"/>
<apex:inputField value="{!Sample_Request_Account_Information__c.Requested_Ship_From_Location__c}" id="f23"></apex:inputField>
<apex:inputField value="{!samObj.Planning_Account__c}" id="f1324"></apex:inputField>
<apex:inputField value="{!samObj.Transportation_Method__c}" id="f24"></apex:inputField>
<apex:inputField value="{!samObj.Account_Name__c}" required="true" onChange="var v = (document.getElementById(this.id + '_lkid')).value; populateData(v);" id="se2"/>
<apex:inputField value="{!samObj.Transportation_Notes__c}" id="f25"></apex:inputField>
<apex:inputField value="{!samObj.Contact_Name__c}" required="true" id="f20"></apex:inputField>
<Br/>
<apex:inputHidden value="{!gotoNewPage}" id="sureid"/>
<Br/>
<!-- <apex:actionRegion> -->
<apex:inputField value="{!samObj.LCL_Address__c}" id="f122">
<apex:actionSupport event="onchange" action="{!populatelcladdress}" reRender="se"/>
</apex:inputField>
<Br/>
<!-- </apex:actionRegion>-->
<apex:inputField value="{!samObj.JDE_Order_Number__c}" id="f215"></apex:inputField>
<apex:inputcheckbox value="{!samObj.Invoice_Required__c}" id="f26"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_1__c}" id="f12"></apex:outputField>
<apex:inputcheckbox value="{!samObj.COA_Required__c}" id="f27"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_2__c}" id="f13"></apex:outputField>
<apex:inputcheckbox value="{!samObj.MSDS_Required__c}" id="f28"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_3__c}" id="f14"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Data_Sheet_Required__c}" id="fMT001"></apex:inputcheckbox>
<apex:outputField value="{!samObj.Ship_To_Address_Line_4__c}" id="f15"></apex:outputField>
<apex:inputcheckbox value="{!samObj.Freight_Charge__c}" id="f248"></apex:inputcheckbox>
<Br/>
<apex:inputField value="{!samObj.Total_weight__c}" id="f21239"></apex:inputField>
<apex:outputField value="{!samObj.Account_Region__c}" id="f212"></apex:outputField>
<apex:inputField value="{!samObj.Requested_Delivery_Date__c}" id="f2549"></apex:inputField>
<apex:outputField value="{!samObj.Ship_To_Country__c}" id="f17"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_State__c}" id="f18"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_City__c}" id="f16"></apex:outputField>
<Br/>
<apex:outputField value="{!samObj.Ship_To_Postal_Code__c}" id="f19"></apex:outputField>
<apex:outputField value="{!samObj.Approvel_Date__c}" id="f29"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Reference_Number__c}" id="f31"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_1__c}" id="f35"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Other_Person_to_Notify_2__c}" id="f37"></apex:inputField>
<apex:outputField value="{!samObj.CABOT_Segment__c}" id="f211"></apex:outputField>
<Br/>
<apex:inputField value="{!samObj.Customer_Group__c}" id="f2112"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Senior_Approver_Name__c}" id="f2341"></apex:inputField>
<apex:inputField value="{!samObj.Opportunity_Name__c}" id="f21"></apex:inputField>
<apex:inputField value="{!samObj.Account_Manager__c}" id="f3221"></apex:inputField>
<Br/>
<apex:inputField value="{!samObj.Technical_Manager__c}" id="f33"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection id="se1">
<apex:inputField value="{!samObj.Notes__c}" style="width: 900px; height: 100px" id="f22"></apex:inputField>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2" id="se2">
<apex:outputField value="{!samObj.ownerId}" id="f11" rendered="{!hasIdval}">{!$User.FirstName} {!$User.LastName}</apex:outputField>
<apex:outputField value="{!samObj.ownerId}" rendered="{!hasNotIdval}" id="usr"></apex:outputField>
<apex:outputtext value="{!samObj.OAP_Order_Number__c}" id="f39"></apex:outputtext>
<apex:outputtext value="{!samObj.OAP_URL_Link__c}" id="f30"></apex:outputtext>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script>
function gotoNewpage()
{
// window.parent.location.href = '/apex/SampleEditPAge';
if(document.getElementById('pg:fm:pd:se:sureid') !=null)
{
var vals = document.getElementById('pg:fm:pd:se:sureid').value;
if(vals == 'sure')
window.parent.location.href = '/apex/SampleEditPAge';
}
}
</script>
</apex:page>
I don't know if this is the specific line number but it could be. If the soql query fails on this you are going to get the error you see. If you reference like a list as you did here:
You can then test the size of the list before referencing the object to see if it found anything or not. If not, you can troubleshoot that to see why you aren't receiving the espected results.