You need to sign in to do that
Don't have an account?
Clarity regarding a received Error Message
Hello,
Have received this error message:
Apex script unhandled exception by user/organization: 00500000006r7Mb/00D00000000hgdL
Visualforce Page: /apex/opportunityButtons
caused by: System.QueryException: List has no rows for assignment to SObject
Class.opportunityButtons.<init>: line 73, column 1
The relevant line from the code; line 73 starts with "theOpp":
public opportunityButtons(ApexPages.StandardController controller) {
refreshOpp = '';
theOpp = [SELECT
Id,
OwnerId,
Contract__c,
Type,
Name,
Pay_Option__c,
StageName,
Amount,
Renewal_Opportunity__r.Id,
Renewal_Opportunity__r.Amount,
Renewal_Opportunity__r.StageName,
RenewalWithUpgrade__c,
RecordTypeId,
triggerTimeStamp__c,
Original_Agreement_Date_New__c,
approvalStatus__c,
Existing_Service__c,
Existing_Downloads__c,
Existing_Slots_per_User__c,
Existing_Users__c,
Existing_Max_Users__c,
Existing_Contract_Term_Months__c,
Existing_Subscription_Total__c,
Pricing_Type__c,
Downloads_Enabled__c,
Slots_per_User__c,
Number_of_Users__c,
Max_Users__c,
Contract_Term_Months__c,
Subscription_Total__c,
Product__c
FROM Opportunity
WHERE Id=:((Opportunity)controller.getRecord()).Id];
SAurl = '';
SSPurl = '';
I haven't made changes, so am confused why this is popping up now? Anybody have an idea?
Thanks,
Julien
and show appropriate error message in the page ?
Avidev is right. You forget to pass id in url like
And if you assign this vf page in sObjects(StandardController) button or link then it'll automattically pass this id.
And you can also use ApexPages.currentPage().getParameters().get('id') for getting the id of the record.
so try this --
Regards
Virendra
"System.QueryException: List has no rows for assignment to SObject" says the query from which you are expecting atleast a record is unable to fetch any record based on criteria specified so it is unable to assign instance of queried sobject records to the List. It must have atleast one record to work with. Make sure your query returns atleast one record.
Its best practice to assign the results of the query to a list, and then check the size of the list to determine whether there were any matches - that will handle 0, 1 or multiple matches so should work in any scenario.