You need to sign in to do that
Don't have an account?
learn_sfdc
pop up on status change in case object
Hello Friends,
I am trying to build a pop up alert box in my case object. Whenever my status field is changed to closed, I want to display a pop up. Here's what I have tried so far:
<apex:page standardController="case">
<script>
windows.document.onload = new function(e) {
if({case.JIRA_Status__c= 'Closed'})
{
alert("True");
} else
{ alert("false";) }
}
</script>
</apex:page>
I am trying to build a pop up alert box in my case object. Whenever my status field is changed to closed, I want to display a pop up. Here's what I have tried so far:
<apex:page standardController="case">
<script>
windows.document.onload = new function(e) {
if({case.JIRA_Status__c= 'Closed'})
{
alert("True");
} else
{ alert("false";) }
}
</script>
</apex:page>
Try this code.
Look out for the ID of your Case Status field (using Developer Console in your Browser) and populate it in line 4 of the code.
Let me know if this helps.
All Answers
This is what you need to add in your VF page.
This piece of script will be executed when the page is loaded.
Please try the below piece of code. Best Regards,
Nagendra.
Hi Shruthi,
Please do the below and let me know the result :)
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
Im using Status as a field in Case object. Whene ever the status becomes closed, i am trying to display pop up.
but i used below code which is not working :(
<apex:page standardcontroller="case">
<script>
var caseStatus = '{!case.Status}';
window.onload = function () {
if(caseStatus == 'Closed'){
// case closed write alert here
alert('Case is closed');
}
else{
alert('Case is not closed');
}
}
</script>
</apex:page>
No luck, i am trying this pop up on standrad case object, is that a problem, below code is not working?
<apex:page standardController="Case" rendered="{!case.Status=='Solution Provided'}">
<script type="text/javascript">
{
window.alert("Your message here");
}
</script> </apex:page>
Hi Shruthi,
Please do the same for your requirement -
Go to case and edit case page layout. Drag the suggested visualforce page on page layout. Edit the visualforce page properties and set Height as 0 pixel. (We don't need to show this page to users.) Save the page layout.
Let me know if you have any doubts.
Thanks
Have you able to show pop up ? If not, please let me know . I am happy to help you :)
My gmailId : - rajatzmaheshwari@gmail.com
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
If yes, you just need to add the following lines inside the <SCRIPT> tag.
Any Javascript code outside a function definition will be executed automatically during the page load.
I actually missed an ! symbol in my previous reply.
Its working... but it works after clicking on save button.
Can you please suggest me to do before saving the pop up to come.
Thanks,
Shruthi
I am trying to create this pop up on existing Standard Case Object.
i trying to write separate VF page.
You can even include the VF page as part of your Page Layouts.
If you still have issues, post your VF page here, we can help you.
below code is working fine but the pop up appears after clicking on save button but i would like to get this pop up before saving the case record.
lets say i entered status value and click on save then the pop up should appear(but record should not be saved) then again i should click on 'ok' on pop up box and click save button to save the record.
<apex:page standardcontroller="case">
<script>
var caseStatus = '{!case.Status}';
window.onload = function () {
if(caseStatus == 'Closed')
{
alert ('Case is closed');
}
}
</script>
</apex:page>
Try this code.
Look out for the ID of your Case Status field (using Developer Console in your Browser) and populate it in line 4 of the code.
Let me know if this helps.