You need to sign in to do that
Don't have an account?

Action Function Not working please help
public class BBH_Survey { public String Survey_res {get;set;} Public BBH_Survey() { CasId='50023000001pb1w'; } Public static void survey_1(){ List<case> lstCase=[select id,status ,Survey_fill__c from case where id =:CasId]; BBH_Surveys__c bbh=new BBH_Surveys__c(); bbh.CaseId__c=lstCase[0].id; bbh.Survey_Response__c= '1'; insert bbh; } } <apex:page controller="BBH_Survey" sidebar="false" > <apex:form > <script> function bbh_survey_1() { survey_1(); } </script> <apex:actionFunction name="survey_1" action="{!survey_1}"/> <apex:commandButton value="1" onclick="bbh_survey_1();" styleClass="btn1" /> </apex:form> <apex:page>
Hello All,
My Action function is not working please help me.
Regards
Sebastian
Can you please try below code (or)
If you want to try with Static method you need to intialize variable inside the static method. please have a look at below example
Static method cannot find the casID
Reference link : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_static.htm
Plese let me know if it is useful (Or) Any help required.
Thanks & Regrads
Madhukar