• Sateesh Kumar
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
Hi,
I have requirement to show a popup box after clicking on the save button on standard page. when some XYZ field != Null, I achived this by creating a visualforce page but the problem here is the POPUP shows on (Onload or Refresh) of a page. I need to stop the popup on onload. How can i achieve this. Below is my code.

​<apex:page standardController="Account" rendered="{!IF(((Account.Type='Dealer' || Account.Type='Flooring Dealer'|| Account.Type='Distributor'||Account.Type='Distributor - IBU'||Account.Type='Retail / DIY' ) && (Account.Account_Status__c = 'Current Customer') && (Account.distributor_locator_relevant__c = 'Yes') && (Account.distributor_locator_movex_ad_number__c = Null || Account.distributor_locator_movex_ad_number__c = '')) ,true,false)}">
 <script type = "text/javascript"> 
     callMe(); 
     //window.onload=function() 
     {
       var url = window.location.href;
       alert(url.indexOf('/006') + ' hiii '+url.indexOf('/e'));
        if(url.indexOf('/006')!=-1 && url.indexOf('/e')!=-1) 
        {
        alert('test');
        }
     } 
         
      if($('#save').click())
          {
          function callMe()
          { 
          var result = confirm("Do you want this location to display in the Dealer Locator on the website? You’ve checked the Distributor Locator Relevant? box, which usually means you want that.Right now, there’s no DL Movex AD number in the distributor locator section of the website - that’s the number that shows that we’re delivering products that reach this location.Without that number, this location won’t show up on the website in the Distributor Locator.Please work with Customer Service to get this fixed.");
if(result) window.parent.location.href = '/{!Account.Id}/e?retURL={!Account.Id}';
          } 
          } 
      </Script> 
</apex:page> 

                     success: function( data ) {
                        response( $ac.map( data , function( item ) {
                            return {                               
                               label: '<a><table><thead><tr bgcolor="#9A9595"><th>AccName</th> <th>BillingCity</th> <th>BillingCountry</th></tr></thead> <tbody><tr><td width="50%">'+
                                item.AccName+'</td> <td width="70%">'
                                +item.BillingCity+'</td> <td width="70%"> '+item.BillingCountry+
                                '</td></tr></tbody></table></a>',
                                value: item.AccName
                            }
                        }));
                    },
                   
CAN SOME ONE HELP ME WITH TEST CLASS.

global class CreateTaskAttchmentEmailExample implements Messaging.InboundEmailHandler {     global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,                                                         Messaging.InboundEnvelope env){       Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();        String myPlainText= '';     myPlainText = email.plainTextBody;          Task[] newTask = new Task[0];     try {       Contact vCon = [SELECT Id, Name, Email         FROM Contact         WHERE Email = :email.toAddresses          LIMIT 1];              newTask.add(new Task(            Priority = 'Normal',            Status = 'Inbound Email',            Subject = email.subject,                       WhoId =  vCon.Id));            insert newTask;           system.debug('===Addresses==>>>'+vCon.Id);      System.debug('New Task Object: ' + newTask );         Attachment attachment = new Attachment();        attachment.Body = Blob.valueOf(email.plainTextBody);        attachment.Name = email.subject;        attachment.ParentId = vCon.Id;        insert attachment;     }         catch (QueryException e) {     System.debug('Query Issue: ' + e);    }    result.success = true;    return result;   } }
Class:
_______________----
public with sharing class SendSMS
{
public void run(String subject,String msg,string smsNumber)
    {
            SessionService S=new SessionService();
            SessionService.SessionServiceSoap sa=new  SessionService.SessionServiceSoap();
             
                sessionservice.BindingResult BinidingResult=Sa.GetBindings(m_Username );
                System.debug('BinidingResult>>>'+BinidingResult.sessionServiceLocation);
                sa.endpoint_x = BinidingResult.sessionServiceLocation;
                // Sa.GetServiceInformation('Salesforce');
                // sa.endpoint_x = 'https://na2.esker.com/EDPWS_C/EDPWS.dll?BindingId=20130730093630andrew.luu@tunstall.com&Handler=Default';
                sessionservice.LoginResult loginResult=sa.Login(m_Username , m_Password );
                String SessinID=loginResult.sessionID;
                submissionservice.SubmissionServiceSoap Submission=new submissionservice.SubmissionServiceSoap();
                Submission.endpoint_x = BinidingResult.SubmissionServiceLocation;
                submissionservice.SessionHeader Header=new submissionservice.SessionHeader();
                Header.SessionID=SessinID;
                Submission.SessionHeaderValue= Header;
                System.debug(Submission.endpoint_x+'********* SessinID ************* '+SessinID);
                // Now allocate a transport with transportName = "SMS"
                    submissionservice.Transport transport = new submissionservice.Transport();
                    transport.RecipientType='';
                    transport.TransportIndex='';
                    transport.TransportName='SMS';
                  
                    submissionservice.vars_element vrs1=new  submissionservice.vars_element();
                    List<submissionservice.Var> VarList=new  List<submissionservice.Var>();
                    submissionservice.Var Vars=new submissionservice.Var();
                    Vars.Attribute = 'Subject';
                   // Vars.type_x='1';
                    Vars.simpleValue = subject;
                   // Vars.nValues=4;
                  
                    submissionservice.Var Vars1=new submissionservice.Var();
                    Vars1.Attribute = 'FromName';
                    // Vars1.type_x='1';
                    Vars1.simpleValue = 'TUNSTALL';
                    // Vars1.nValues=4;
                  
                    submissionservice.Var Vars2=new submissionservice.Var();
                    Vars2.Attribute = 'SMSNumber';
                    // Vars2.type_x='1';'216-256-8216'
                    Vars2.simpleValue = smsNumber;     
                    // Vars2.nValues=4;
                  
                    submissionservice.Var Vars3=new submissionservice.Var();
                    Vars3.Attribute = 'Message';
                    // Vars3.type_x='1';
                    Vars3.simpleValue = msg;
                    // Vars3.nValues=4;
                  
                    VarList.add(Vars);
                    VarList.add(Vars1);
                    VarList.add(Vars2);
                    VarList.add(Vars3);
                    vrs1.Var=VarList;
                    transport.Vars=vrs1;
                    System.debug('######### Mahesh ############# '+submission.submitTransport(transport));
          
  
    }
}

@Test Class
public class SendSMS_TC
{
    static testmethod void m1()
    {
        SendSMS ss = new SendSMS();
        ss.run('test data','test','678jjh');
    }
}
Class:
_______________----
public with sharing class SendSMS
{
public void run(String subject,String msg,string smsNumber)
    {
            SessionService S=new SessionService();
            SessionService.SessionServiceSoap sa=new  SessionService.SessionServiceSoap();
             
                sessionservice.BindingResult BinidingResult=Sa.GetBindings(m_Username );
                System.debug('BinidingResult>>>'+BinidingResult.sessionServiceLocation);
                sa.endpoint_x = BinidingResult.sessionServiceLocation;
                // Sa.GetServiceInformation('Salesforce');
                // sa.endpoint_x = 'https://na2.esker.com/EDPWS_C/EDPWS.dll?BindingId=20130730093630andrew.luu@tunstall.com&Handler=Default';
                sessionservice.LoginResult loginResult=sa.Login(m_Username , m_Password );
                String SessinID=loginResult.sessionID;
                submissionservice.SubmissionServiceSoap Submission=new submissionservice.SubmissionServiceSoap();
                Submission.endpoint_x = BinidingResult.SubmissionServiceLocation;
                submissionservice.SessionHeader Header=new submissionservice.SessionHeader();
                Header.SessionID=SessinID;
                Submission.SessionHeaderValue= Header;
                System.debug(Submission.endpoint_x+'********* SessinID ************* '+SessinID);
                // Now allocate a transport with transportName = "SMS"
                    submissionservice.Transport transport = new submissionservice.Transport();
                    transport.RecipientType='';
                    transport.TransportIndex='';
                    transport.TransportName='SMS';
                  
                    submissionservice.vars_element vrs1=new  submissionservice.vars_element();
                    List<submissionservice.Var> VarList=new  List<submissionservice.Var>();
                    submissionservice.Var Vars=new submissionservice.Var();
                    Vars.Attribute = 'Subject';
                   // Vars.type_x='1';
                    Vars.simpleValue = subject;
                   // Vars.nValues=4;
                  
                    submissionservice.Var Vars1=new submissionservice.Var();
                    Vars1.Attribute = 'FromName';
                    // Vars1.type_x='1';
                    Vars1.simpleValue = 'TUNSTALL';
                    // Vars1.nValues=4;
                  
                    submissionservice.Var Vars2=new submissionservice.Var();
                    Vars2.Attribute = 'SMSNumber';
                    // Vars2.type_x='1';'216-256-8216'
                    Vars2.simpleValue = smsNumber;     
                    // Vars2.nValues=4;
                  
                    submissionservice.Var Vars3=new submissionservice.Var();
                    Vars3.Attribute = 'Message';
                    // Vars3.type_x='1';
                    Vars3.simpleValue = msg;
                    // Vars3.nValues=4;
                  
                    VarList.add(Vars);
                    VarList.add(Vars1);
                    VarList.add(Vars2);
                    VarList.add(Vars3);
                    vrs1.Var=VarList;
                    transport.Vars=vrs1;
                    System.debug('######### Mahesh ############# '+submission.submitTransport(transport));
          
  
    }
}

@Test Class
public class SendSMS_TC
{
    static testmethod void m1()
    {
        SendSMS ss = new SendSMS();
        ss.run('test data','test','678jjh');
    }
}