• Krishnamoorthi Periasamy
  • NEWBIE
  • 54 Points
  • Member since 2014
  • Salesforce Technical Consultant

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 27
    Replies
I have never created a new trigger before.  I have it working beautifully in UAT :-) but when I went to replicate in Production, it seems you can't just 'add' a new trigger.  It has to be moved or pushed?  And, it needs to account for testing coverage?  The code I need to move is below:

trigger TaskCompletion on Task (after insert,after update) {
    
    list<task> lst_Task = new list<task>(); 
    set<id> cID = new set<id>();
    
    Map<id,Payroll_Checklist__c> MP_chklst;
    
        for(task task_obj :trigger.new)
    {
            cID.add(task_obj.whatid);
    }

    MP_chklst = new Map<id,Payroll_Checklist__c>([SELECT ID,Checklist_Complete__c FROM Payroll_Checklist__c WHERE ID IN : cID ]);
    
    for(task task_obj :trigger.new)
    {
        if(task_obj.status == 'Completed')
        {
          MP_chklst.get(task_obj.whatid).Checklist_Complete__c = true;
        }
    }
    
        update MP_chklst.values();
}


Does anyone have some quick/easy steps to move it to Production?  And, do I need to do anything to the code to account for the testing coverage?  I'm sure this is basic, but development of triggers is new for me!
<apex:page standardController="Lead">
<apex:form >
<apex:pageBlock title="New Lead">
   <apex:pageBlockSection columns="2">
     <apex:inputtext value="{!Lead.Name}" label="Name"/>
     <apex:inputfield value="{!Lead.Email}" label="Email"/>
     <apex:inputfield value="{!Lead.Status}" label="Status"/>
     <apex:inputfield value="{!Lead.MobilePhone}" label="Mobile Phone"/>
     <apex:inputfield value="{!Lead.Company}" label="Company Name"/>
     <apex:inputfield value="{!Lead.AnnualRevenue}" label="Annual Revenue"/>
     <apex:inputfield value="{!Lead.Fax}" label="Fax"/>
     <apex:inputfield value="{!Lead.Title}" label="Title"/>
     <apex:inputfield value="{!Lead.Website}" label="Website"/>
   </apex:pageBlockSection>
   
   <apex:pageBlockButtons >
      <apex:commandButton action="{!Save}" value="Save"/>
      <apex:commandButton action="{!Cancel}" value="Cancel"/>
      <apex:commandButton action="{!Edit}" value="Edit"/>
      <apex:commandButton action="{!View}" value="View"/>
      <apex:commandButton action="{!Delete}" value="Delete"/>
   </apex:pageBlockButtons>
   
</apex:pageBlock>
<apex:detail relatedList="true"/>
 </apex:form>
</apex:page>
Hello, 

I have this commandlink on a visualforce page:
 
<apex:commandlink action="{!saveProdChanges}" rerender="Messages" value="Save" immediate="true" styleclass="buttonprod" onclick="console.log('click save')">
                                                                    <apex:param name="buttonsave" value="{!product.id}" id="saveParam" assignTo="{!saveProd}"/>                                                                  
                                            </apex:commandlink>

which calls this method on my controller:
public string saveProd {get; set;}

public pageReference saveProdChanges(){

producto_simulacion__c productoEdit = new producto_simulacion__c();
productoEdit = [SELECT Id, categoria__c, cantidad__c, importe__c, descripcion__c, costo_unitario__c FROM producto_simulacion__c WHERE id =: saveProd];

update productoEdit;
}
I edited so i can try the button, I also trying with just:
 
public pageReference saveProdChanges(){

system.debug('Hello, this is saveProdChanges method');

}

but is not doing anything when i press the button. Browser console is not showing any error, it's displaying correctly the console.log on it.
Log in developer console is not showing the debug, but it does a log when I click it....

What could be wrong?

 
  • April 06, 2017
  • Like
  • 0
In lightning components, what is the difference between .THIS.mycustomclass versus .THIS .mycustomclass?
 
.THIS .mycustomclass {
   //css styling
}


.THIS.mycustomclass {
  //css styling
}



 
Hello,

we are trying to send an email using a custom button. The email is intended for a specific email address. This is the code we are using:
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}

var message = new sforce.SingleEmailMessage(); 

message.setToAddresses = 'test@test.com';
message.plainTextBody = 'It would be so awesome if this worked.';
message.setCcAddresses = 'test2@test.com';
message.setBccAddresses = 'test3@test.com';
message.setSubject = 'Data upload report';

var result = sforce.connection.sendEmail([message]); 
alert(result);

unfortunately this is the error message we are getting.

error

what are we doing wrong?


Thank you.
Hi.  I am trying to create a new custom button which functions the same way as the Create Case Comment Button.  Anyone have the code to create this button?
Hello, 

I have a picklist field, homefree__c, with 4 values, but I only want a validation rule to create an error if only 1 of the list values is chosen; Echo

I tried this, but its not working, please help:
 
TEXT(NOT(homefree__c,"Echo"))

 
Hello Everyone,
My requirement is to integrate salesforce with third party lead generator (Lending Tree). They provide leads in JSON format. 
I am looking for approaches to push JSON format leads from lending tree into salesforce.

 
Hi Team,

Need Help. I have a requirement in which I have to exclude the weekend days and holidays and I have to perform calculations on business day. So during weekend and holidays, my calculation should not work and should continue from next business day. eg. suppose  I  have to complete a task between given start date and end date. But there are two days in between which is weekend days. I want to find how much work is required to be completed in each day excluding those 2 days.Anyone have any idea. 
I have never created a new trigger before.  I have it working beautifully in UAT :-) but when I went to replicate in Production, it seems you can't just 'add' a new trigger.  It has to be moved or pushed?  And, it needs to account for testing coverage?  The code I need to move is below:

trigger TaskCompletion on Task (after insert,after update) {
    
    list<task> lst_Task = new list<task>(); 
    set<id> cID = new set<id>();
    
    Map<id,Payroll_Checklist__c> MP_chklst;
    
        for(task task_obj :trigger.new)
    {
            cID.add(task_obj.whatid);
    }

    MP_chklst = new Map<id,Payroll_Checklist__c>([SELECT ID,Checklist_Complete__c FROM Payroll_Checklist__c WHERE ID IN : cID ]);
    
    for(task task_obj :trigger.new)
    {
        if(task_obj.status == 'Completed')
        {
          MP_chklst.get(task_obj.whatid).Checklist_Complete__c = true;
        }
    }
    
        update MP_chklst.values();
}


Does anyone have some quick/easy steps to move it to Production?  And, do I need to do anything to the code to account for the testing coverage?  I'm sure this is basic, but development of triggers is new for me!
This My Code
  1. global class BatchOpportunitys implements Database.Batchable <sObject>{
  2.     
  3.     Id oppRecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('New Rec Type').getRecordTypeId(); 
  4.     date dt4 = system.today();  
  5.      
  6.     global Database.QueryLocator start(Database.BatchableContext BC){
  7.         
  8.         
  9.         String query = 'SELECT Id,StageName FROM Opportunity RecordTypeId =:oppRecordTypeId AND StageName : Prospecting';
  10.         return Database.getQueryLocator(query);
  11.         
  12.     }
  13.     global void execute(Database.BatchableContext BC, List<Opportunity> scope){
  14.         
  15.         for(Opportunity opps : scope)
  16.          {   
  17.              System.debug('opps');
  18.              opps.StageName = 'Qualification';
  19.             opps.CloseDate = dt4;
  20.              opps.account.ownerId = opps.ownerId;
  21.              opps.account.Status__c = 'Lost';         
  22.          }
  23.          update scope;
  24.          System.debug('Record'+scope); 
  25.     }
  26.                
  27.             
  28.     global void finish(Database.BatchableContext BC){
  29.             
  30.     }
  31. }