+ Start a Discussion
Nick HoffNick Hoff 

Pop up message based on field values after insert

Hi All,
I am attempting to create a pop up message on the Cases page for my community portal to prompt the users to call our support line if the issue they have submitted has been calculated as a "P1". i have attempted a few times but my coding skills are not where they need to be yet as apex is new for me. the field that i have created that it would need to trigger off of is a custom formula field Called "P1_Ticket__C" it is a boolean field and if it is checked i would like it to generate a pop up message that does not stop the user from saving teh record only to remind them to call our support number.

if someone can help me out wiht the code for this it would be super helpful.
Shawn Reichner 29Shawn Reichner 29
Nick,

This may not help, but some things I have done to satisfy this type of requirement both from a stop message, and a more warnign type message. 

If you would rather stop them from savign the ticket and they must call, you can create a custom save button and add some java code such as the following:

var p1save= "{!Case.P1_Ticket__c}"; 

if(p1save== TRUE){ 
html = '<div id="dialog" style="display: none" title="Error"><p> Please Contact our support line at 1-800-111-1111 {!$Profile.Name} </p></div>'; 
dialogBox(html); 
}else{
window.location = save path for your org and object
}

function dialogBox(){
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js')} 
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js')} 

var $g = jQuery.noConflict(); 
$g(function() { 
$g('head').append('<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">'); 
$g('body').append(html); 

$g("#dialog").dialog({
dialogClass: "no-close", 
autoOpen: true,
buttons: [
{
text: "OK",
click: function() {
$g( this ).dialog( "close" );
}
}


}); 
});
}


If you truly want to do a warnign , you can create an Image that is colorful and has your message to call your support line in the text and formattign that you want and the size you want, and then save that image into Salesforce as a document. 

Then you can create a formula field on your case object that if the P1 Ticket field is true, then display this image.  You can then place this field at the top of the page layout your community users are assigned so after they save the record, this big image is satring right at them.

So in essense it is not a popup, but the point and messaging will be the same if needed. 

Hope this helps,

Shawn