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
ChinnoduChinnodu 

i want popup message alert when a Case is opened for more than 48 hours for the Product Set Archer using javascript

Hi Experts, 

Actually i want popupp messge alert when" a Case is opened for more than 48 hours for the Product Set Archer" now it is working. but what happen here while creating a new case at that time also i am getting popup message alert. please let me know how to avoid in visualforce page.


please see the my code
 
function displayAACNotification() 
        {   //alert('test'); 
            //alert('AAC function'+ {!Case.Number_of_hours_back_case_created__c}); 
            var caseHours = '{!Case.Number_of_hours_back_case_created__c}'; 
            var AAC = '{!Case.PL_Affected_Area_Category__c}'; 
            var AASC1 = '{!Case.PL_Affected_Area_Subcategory__c}'; 
            var AASC2 = '{!Case.PL_Affected_Area_Subcategory2__c}'; 
            Var AASD='{!Case.Affecte_Date__c}'; 
            var Type="{!Case.Type__c}"; 
            var cowner = '{!Case.OwnerId}'; 
            var recordtypeName='{!objRecordType.Name}'; 
            var PRODSET = '{!Case.PL_RSA_Product_Set__c}'; 
            var CDate = '{!Case.CreatedDate}'; 
            
            sforce.connection.sessionId = "{!$Api.Session_ID}";         
            console.log(sforce.connection.getUserInfo().userId); 
           var usrid = sforce.connection.getUserInfo().userId; 
              //alert(sforce.connection.getUserInfo().userId); 
             
             
                   
              if((recordtypeName=="Customer Support"  && usrid == cowner) && ((AAC == null || AAC =='') || (AASC1 == null || AASC1 == '')) && (Type == 'Technical Support' && PRODSET == 'Archer' && (AASD-CreatedDate)>2)))

            { 
                
                alert('Affected Area Category and Subcategory1 are required by the Case Owner when a Case is opened for more than 48 hours for the Product Set Archer. Please update the values before proceeding.');

            } 
        }



Thanks,
Chinnodu
GauravendraGauravendra
Hi Chinnodu,

At the time of inserting the case, the case isn't saved in database. So, it won't have it associated ID. 
You can apply the check if the case Id is blank then won't show the alert.

Hope this helps.