• Ajitkumar Pradhan 9
  • NEWBIE
  • 70 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 18
    Replies
Populate the comma separated related Contact name on Account Description field which should work for insert, update and delete case.
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName =\'Lost\'';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }try{
update oppList;
}
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
    }    
}
If type 15/10/95 it should change to 15/10/1995 where as 1/1/10 it should change to  1/1/2010
 How can I achieve this for every date field present in My org?
What will be the code for this.
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName ='\Lost\'';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }try{
update oppList;
}
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
    }    
}

Code is not working. The opportunity satge is not getting updated.
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where (JobDiva_ID__c!=null AND StageName ="Lost")';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if (opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }
           try{
                update oppList;
            }
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
     
    }    
}
trigger trigMapFields on Lead (before update) {

    Map<Home_Phone,String> leadHome = new Map<Home_Phone,String>(); // Map of the converted Contact phone and the Lead phone

    for(Lead lead : Trigger.new) {
        if (lead.IsConverted) {
            leadStatus.put(lead.ConvertedContactHome_Phone,lead.Home_Phone);
        }
    }
    List<Contact> conContacts = [select Phone from Contact WHERE Contact.Home_Phone IN :leadHome.keySet()];
    for ( Contact c : conContacts) {
        c.Phone = leadHome.set(Home_Phone);
    }
    update conContacts;
}

is this the correct trigger? can anyone correct me if i am wrong?
If type 15/10/95 it should change to 15/10/1995 where as 1/1/10 it should change to  1/1/2010
 How can I achieve this for every date field present in My org?
What will be the code for this.
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName ='\Lost\'';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }try{
update oppList;
}
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
    }    
}

Code is not working. The opportunity satge is not getting updated.
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where (JobDiva_ID__c!=null AND StageName ="Lost")';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if (opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }
           try{
                update oppList;
            }
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
     
    }    
}
trigger trigMapFields on Lead (before update) {

    Map<Home_Phone,String> leadHome = new Map<Home_Phone,String>(); // Map of the converted Contact phone and the Lead phone

    for(Lead lead : Trigger.new) {
        if (lead.IsConverted) {
            leadStatus.put(lead.ConvertedContactHome_Phone,lead.Home_Phone);
        }
    }
    List<Contact> conContacts = [select Phone from Contact WHERE Contact.Home_Phone IN :leadHome.keySet()];
    for ( Contact c : conContacts) {
        c.Phone = leadHome.set(Home_Phone);
    }
    update conContacts;
}

is this the correct trigger? can anyone correct me if i am wrong?
What is the syntax to use Priorvalue of  field in parent record Validation Rule

ISPICKVAL( Delivery__r.Delivery_status__c , "Delivered")
the one below does not wok
ISPICKVAL( PRIORVALUE(Delivery__r.Delivery_status__c , "Delivered"))