You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Error in Apex class: Illegal conversion from Contact to System.PageReference
Hello, I build a small Visualforce page with an apex class.
I get the error "Illegal conversion from Contact to System.PageReference" at return obj; .
Could you tell me how I can fix this error?
VF:
Apex class:
I get the error "Illegal conversion from Contact to System.PageReference" at return obj; .
Could you tell me how I can fix this error?
VF:
<apex:page controller="updateJobStatus" action="{!updateRec}" cache="false"> <apex:form> Thank you. </apex:form> </apex:page>
Apex class:
public class updateJobStatus{ public String recId {get;set;} public String isJobCompleted {get;set;} public updateJobStatus() { recId = ApexPages.currentPage().getParameters().get('recId'); isJobCompleted = ApexPages.currentPage().getParameters().get('isJobCompleted'); } public PageReference updateRec() { Contact obj = new Contact(); obj.Id = recId; obj.R_ckantwort__c = isJobCompleted; update obj; return obj; } }
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh