I am pasting a complete code for anyone reference if they like to resolve it.(Just incase they want to know what i could be missing.)
NOTE: CaseOwnerChanged__c = Checkbox field type
<apex:page standardController="Case" extensions="ChangeCaseOwnerNotificationCtrlr">
<script type="text/javascript">
alert('{!Case.Id}');
window.document.onload= new function(){
if(({!Case.AccountId == '0013000000bFnBwAAK'} && {!Case.Classification__c =='ASO'})&& {!Case.CaseOwnerChanged__c}){
alert("xyz");
}
RevertCheckBox('{!Case.OwnerId}');
}
</script>
<apex:form >
<apex:actionFunction name="RevertCheckBox" action="{!checkCaseOwner}">
<apex:param id="anode" name="ownerIdVar" value="" assignTo="{!aCaseId}"/>
</apex:actionFunction>
</apex:form>
</apex:page>
I am using a check box field a Case Object to check some condition, if its TRUE i am showing a popup (alert!!). But Once the checkbox is used to show the popup, i want to revert it back to false, for which i tried using RevertCheck JS function using ActionFunction, passing the Case.Id to controller, as
public with sharing class ChangeCaseOwnerNotificationCtrlr {
public static Id aCaseId {get;set;}
public ChangeCaseOwnerNotificationCtrlr(ApexPages.StandardController controller) {
}
public void checkCaseOwner(){
system.debug('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'+ aCaseId);
Case c =[SELECT id,CaseOwnerChanged__c from case where id =: aCaseId];
//Case c = new Case(Id = aCaseId);
c.CaseOwnerChanged__c=false;
update c;
}
}
But this does not works. Could you please help me this regard.! Would be grateful. (If you want any other details, please revert me back thru the same) Thanks
Caseobject in the controller? you need to update a field of current case object isn't it?RevertCheck()JS function? without calling it you can't seealert()you can't see debug statement