You need to sign in to do that
Don't have an account?
Vigneshwaran Loganathan
Error: Compile Error: Non-void method might not return a value or might have statement after a return statement
public pagereference submit()
{
integer count = [select count() FROM Sworn_Undertaking__c WHERE id =:swornUT.id];
if (count>0) // Error at this Line
{
if(SUT.submit_done__C == false)
{
sakid = 'Y';
system.debug('***sakid'+sakid);
SUT.City_of__c = swornUT.City_of__c;
SUT.Address__c = swornUT.Address__c;
upsert SUT;
}
else
{
sakid = 'N';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));
}
return null;
else
{
sakid = 'N';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));
}
pagereference pdf = page.pdfSwornUndertaking;
pdf.getParameters().put('id',SUT.New_applicant_Name__c);
Attachment attach = new Attachment();
Blob body;
try
{
body=pdf.getcontent();
}
catch(visualforceException e)
{
body=Blob.valueOf('Some Text');
}
return null;
}}
I have given return null but its still shows the same.. Am i wrong Anywhere?
{
integer count = [select count() FROM Sworn_Undertaking__c WHERE id =:swornUT.id];
if (count>0) // Error at this Line
{
if(SUT.submit_done__C == false)
{
sakid = 'Y';
system.debug('***sakid'+sakid);
SUT.City_of__c = swornUT.City_of__c;
SUT.Address__c = swornUT.Address__c;
upsert SUT;
}
else
{
sakid = 'N';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));
}
return null;
else
{
sakid = 'N';
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));
}
pagereference pdf = page.pdfSwornUndertaking;
pdf.getParameters().put('id',SUT.New_applicant_Name__c);
Attachment attach = new Attachment();
Blob body;
try
{
body=pdf.getcontent();
}
catch(visualforceException e)
{
body=Blob.valueOf('Some Text');
}
return null;
}}
I have given return null but its still shows the same.. Am i wrong Anywhere?
The 'return null' is inside the if condition.
You need to add it outside the if condition.
Regards,
Prakash B