function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StaciStaci 

pop-up help

So I have created this pop up when cases are logged as critical cases to remind the customer to call the hotline.

 

Problem 1 - I works fine in IE and Chrome, only thing in Chrome, you can't see the style sheet colors.  Anyone know how to remedy this?

 

Problem 2 & 3 - it doesn't show up when logged in as Partner and Customer portal users, works fine as myself (admin).  Is there any way to turn this "on" to portal users.  This is who really needs the reminder

 

Apex Page:

<apex:page standardController="Case" rendered="{!Case.Impact__c = 'Site Production Down'}" extensions="CW_alertMessage">

<script type="text/javascript">
{
    window.showModalDialog("{!urlRec}","dialogWidth:1200px; dialogHeight:200px; center:yes");
}

</script>


</apex:page>

 Apex Page with Alert Message:

<apex:page standardStylesheets="false" showHeader="false">

 <apex:stylesheet value="{!$Resource.mystyle}"/>
  <h1 class="myStyle">You have indicated that site operations is critically impaired.</h1>
  <p>Please contact <b>800-480-9830</b> to ensure Product Support is aware of your incident.
  <br><br>If site operations is not currently critically impaired, please adjust the value <br>in the <b>IMPACT</b> field to accurately reflect current site functionality</br></br></br></p>
  
</apex:page>

 Apex Class:

public with sharing class CW_alertMessage {

    public CW_alertMessage(ApexPages.StandardController controller) {

    }
public string geturlRec()
{
    string urlRec='https://caterpillar--cw.cs15.my.salesforce.com/apex/CW_AlertMessagePage';
    return urlRec;
}

}

 Static Resource:

body  {
   background-color: #236FBD;
}
 
.pbTitle {
    background-color: yellow;
}         
.myStyle {
    background-color: red; 
    
}  

 

Best Answer chosen by Admin (Salesforce Developers) 
cmoylecmoyle

Problem 2 & 3: In your getUrlRec method, I would change it to this:

 

PageReference p = Page.CW_AlertMessagePage;
return p.getUrl();

 Sites don't typically use the /apex/pagename syntax and so the above method will pull the appropriate URL for that page depending on the context. Secondly, be sure to the at the profile for the sites guest users. There will be a section for enabled vf pages. Be sure to add your page.

All Answers

cmoylecmoyle

Problem 2 & 3: In your getUrlRec method, I would change it to this:

 

PageReference p = Page.CW_AlertMessagePage;
return p.getUrl();

 Sites don't typically use the /apex/pagename syntax and so the above method will pull the appropriate URL for that page depending on the context. Secondly, be sure to the at the profile for the sites guest users. There will be a section for enabled vf pages. Be sure to add your page.

This was selected as the best answer
StaciStaci

Thanks cmoyle.  Do I need to change anything in my page too?  Its still not working.

 

<apex:page standardController="Case" rendered="{!Case.Impact__c = 'Site Production Down'}" extensions="CW_alertMessage">



<script type="text/javascript">
{
   
    window.showModalDialog("{!getUrl}","dialogWidth:1200px; dialogHeight:200px; center:yes");
}

</script>



</apex:page>

 

cmoylecmoyle

Are you getting any kind of error or is the modal simply not rendering anything?

StaciStaci
no error, just shows nothing. It was working as myself, now its not even showing anything as myself. I have also added the pages and classes to the profiles
cmoylecmoyle
Are any javascript errors showing in the browser console?
StaciStaci
nope nothing showing in Chrome or IE
cmoylecmoyle

Well I'm stumped, I spun up a developer org and tested it out and was able to see my modal window in both sites and internal. Best I can say is make sure the public access profile on your site has access to all objects and pages that both the main page and the modal will access. I also noticed you change urlRec to getUrl...I can't see that being the problem, but make sure its referencing something in your controller. If I think of anything, I'll get back to you.

StaciStaci

Just had a DO'H moment!  I forgot I had removed the VF Page from the layout cause it was annying me when testing something else last week.  I added it back and now its working for everyone!  Thank you!

StaciStaci

one more question for you.  Wondering if this is doable BEFORE a case is entered?  For instance, the user is filling out the case information and they choose Impact as Site Down.  Once they select that, before they even click Save, can this message pop up?

cmoylecmoyle
If you are using the out of the box layout for cases, then no it wouldn't be doable when a select box is changed. However, you could add a custom button that executes the javascript that the user would have to click.