• lalitarora
  • NEWBIE
  • 10 Points
  • Member since 2015
  • Tech Lead

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies
trigger LogoutEventTrigger on LogoutEventStream (after insert) {
    
    LogoutEventStream event = Trigger.new[0];
    String EventjsonString = json.serialize(Trigger.new[0]);
    LogoutEventtriggerHandler.CreateLog(EventjsonString);    
    
}
Here, onchange event supposed to be hit when I change the date value and loose focus from the field. But, actionsupport is firing even if i change any of the value mm,dd or yyyy without loosing the focus. Means if I need to change dd, mm and yyyy all 3 manually without using calender datepicker, this action support will fire 3 times. 

I tried using 'onblur' that working fine but it fires actionsupport even when value is not change which I dont want. Any help appreciated!

 <apex:input type="date" value="{!sdr.ProposedStartDate}" style="width:120px">
                 <apex:actionSupport event="onchange" action="{!SaveSSA}" rerender="MainTable,TotalProposedGP,TotalProposedNP,TotalLaspedSF,GrandTotal,MainForm"  oncomplete="searchable();" status="statusSaveTrip"/>
                </apex:input>
Datatable not showing filters after getting rerendered, when i click button to rerender data table it loses it style and show compact data.


           <apex:commandButton value="Rerender table" action="{!abc}" rerender="tblWRsa" rendered="true"/>
         
    </apex:pageBlockButtons>
    <apex:pageBlockSection columns="1" id="pbs1">
          <apex:outputPanel id="panel_1">
               <apex:dataTable value="{!abc}" var="wrsa"  id="tblWRsa" >
......
....
               </apex:dataTable>
          </apex:outputPanel>
    </apex:pageBlockSection>
</apex:pageBlock>


Before User-added image


AfterUser-added image
Below is the trigger 
 
trigger TaskBeforeDelete on Task (before delete) {

      Map<Id,Profile> profileMap=new Map<Id,Profile>([SELECT Id,Name FROM Profile WHERE Name  IN ('Standard User')]);
       
    System.debug('profileMap==>'+profileMap);
    
    profile p=profileMap.get(UserInfo.getprofileID());
     try {
        
        for (Task task : Trigger.old)  {    
        
        	  if(task.Activity_LFD_Type__c.equalsIgnoreCase('Test') && task.WhatId.getSObjectType() == account.sObjectType && task.WhatId != null && (p==null) )           
            
            {    
                if(!Test.isRunningTest()){
                
                task.addError('You are not permitted to delete this task');
                
                }
     
            }
        
        }
        
    } Catch(Exception e){
        
            
       throw new RuntimeException('****TaskBeforeDelete:'+':' +e.getMessage());
    }
        
     }

Below is the test class 
 
@istest

    public class TaskBeforeDelete_Test{
    
    public static testMethod void BeforeDelete(){ 
    
           Profile pId = [SELECT Id FROM Profile WHERE Name = 'Test Profile'];
        
         User testUser = new User(Email='test@email.com',Phone='555-555-5555',
                                 FirstName='Test',LastName='User', ProfileId=pId.Id,UserName=uniqueName + '@test' + orgId + '.com',
                                 Alias='tesUse',TimeZoneSidKey='America/New_York',
                                 LocaleSIdKey='en_US',EmailEncodingKey='UTF-8',
                                 LanguageLocaleKey='en_US'); 
                                 
        
        system.runAs(testUser){
        
        account acc= new account();
        acc.name='test';
        acc.Site='testsite';
        insert acc;
        
        
       task task=new task();
       task.Activity_LFD_Type__c='Test';
       task.whatid=acc.id;
       
       insert task;
       
       delete task;
       
       }
        
    
    }


}

For the above trigger the code coverage is below 75 % and i'm not able to cover the catch block.

Can any one suggest on this please.
Challenge Not yet complete... here's what's wrong: 
The 'SpeakerControllerExtension' Apex class was not found

although i have the class named this.
 
Datatable not showing filters after getting rerendered, when i click button to rerender data table it loses it style and show compact data.


           <apex:commandButton value="Rerender table" action="{!abc}" rerender="tblWRsa" rendered="true"/>
         
    </apex:pageBlockButtons>
    <apex:pageBlockSection columns="1" id="pbs1">
          <apex:outputPanel id="panel_1">
               <apex:dataTable value="{!abc}" var="wrsa"  id="tblWRsa" >
......
....
               </apex:dataTable>
          </apex:outputPanel>
    </apex:pageBlockSection>
</apex:pageBlock>


Before User-added image


AfterUser-added image
I am trying to deploy a Trigger and also an Apex class which the trigger is using.

In Sandbox, I wrote a test case which gives the Apex Class 85% coverage and the Trigger says it has 100% code coverage.

I put these both in an outbound change set and push to production.

On production I validate it and then it fails on code coverage and says my trigger has 0% coverage?

Thanks
Hi i have written the trigger  in such away that when i update the  contact record , another Contact  record  hasto be inserted .But when i try to update the existing record it throwing the error like  " execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.wed: line 39, column 1" 

and my code is as below,

trigger wed on Contact(Before insert, Before Update)
{

Public Account a;

Public List<Contact> ab;

if(Trigger.isinsert==TRUE)
{
For(Contact c:Trigger.New)

{

ab=new List<Contact>();

 a= [select Phone from Account where ID=:c.AccountID];
 
 c.Phone=a.Phone;
 
 ab.add(c);
 
}

}

if (Trigger.isUpdate==TRUE)
{

For(Contact ct:Trigger.New)
{

String stv=ct.FirstName;

Contact cts=new Contact();

cts.FirstName='ram';
cts.LastName=ct.LastName;

ab.add(cts);

}
insert ab;

}

}

So please suggest me any one, where iam doing the error.




 
Hi,

We have done a call out to external system and got below error.


02:29:49.22 (252404337)|FATAL_ERROR|System.CalloutException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.

Please let us know how to solve this error.

we are using Rest call out for this service.

Thanks!
 
trigger Account2 on Account (before insert) {
    List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    for (Account myAccount : Trigger.new) {
    if (myAccount.Email != null && myAccount.FirstName = "AccountName") {
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         List<String> sendTo = new List<String>();
        sendTo.add(00528000002VHIK.Email);
        mail.setSubject('An account has been created');
      String body = 'Dear ' + myAccount.FirstName + ', ';
      body += 'An account has been created and name is "AccountName"';
    }
        
            Messaging.sendEmail(mails);
        }
    

}

please help me for this code
Hi All,

Hope someone can help me on this.
I have created an custom account lookup because with standard account lookup i am unable to add contact filter.
Now I have to autopopulate account name on the custom account field on quote from the opportunity object or possibliy from Account Object itself. It should autopopulate when i click the new button on quote. 
I tried some trigger but i hope there is some mistakes.Please see below.

trigger updateQuoteAccount on Quote (before insert, before update) {
      List<Quote> OpportunitiesToUpdate = new List<Quote>();
      for(Quote QA : [Select Id, Opportunity.Account.Id From Quote Where Id IN : trigger.newMap.keyset()]) {
            QA.Account_c = QA.Opportunity.Account.Id;
             QuoteToUpdate.add(QA);            
       }   
       if(!QuoteToUpdate.isEmpty())
                update QuoteToUpdate;
 

Is there anyway to automatically deploy Case Escalation Rules and Actions using either Eclipse or the Foce.com deploy tool?