• Asad Wali
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 8
    Replies
  1. Create custom object with name Item and add Account field as a reference. (It should be visible in related list of Account)
    1. Add custom field with name Amount in Item object.
    2. It should be currency field with 2 digit values.
  2. Add custom field (integer) with name No. of items in Account. It should be mandatory.
    1. On creation of account, create user specified number of items.
    2. Names should be like Item 1, Item 2, … Item n.
  3. Add summary field in Account to show sum of Amount of all Items.
  1. Enlist all Account records on a page.
    1. Lightning theme should be followed. (https://lightningdesignsystem.com)
  2. Add Name, Account Number and  Phone filters to filter Account records.
  3. Add New button on page to add new Account from front end. (Popup should open)

HI Everyone.

I hope you are all fine and doing great.

I need help in trigger on after update.

I want when i change address in my lead, if address change by user trigger call and update my one custom field which apn__c.

Thanks in Advance

  1. Enlist all Account records on a page.
    1. Lightning theme should be followed. (https://lightningdesignsystem.com)
  2. Add Name, Account Number and  Phone filters to filter Account records.
  3. Add New button on page to add new Account from front end. (Popup should open)

HI Everyone.

I hope you are all fine and doing great.

I need help in trigger on after update.

I want when i change address in my lead, if address change by user trigger call and update my one custom field which apn__c.

Thanks in Advance

Dear Forum, 

I am trying to develope an Apex program and corresponding trigger that will grab JSON from an endpoint im hosting and based on values inside that json file make updates to custom fields "checkboxes" under the contacts object. Right now I have a wrapper that stores my JSOn, a program that grabs my data from an endpoint then stores it, and finally a piece of data that creates a list of contact objects that I then use to update my database. The problem is I am now getting this error: "Future method cannot be called from a future or batch method." Below are snippits of code showing what I am doing, as well as the corresponding apex trigger. I am still very new to Apex development and apologize if this question was ansered in another post somewhere else. 
public class JSONDeserialize {

    public GDPRWrapper wrapper {get;set;}
    public JSONDeserialize(){
    
        
        deserialize();
    }
    
    @Future(callout=true)
    public static void deserialize() {
        GDPRWrapper wrapper;
    
        
        Http h = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndPoint('***********************');
        Blob headerValue = Blob.valueOf('*****************');
        String authorizationHeader = ('Basic ' + EncodingUtil.base64Encode(headerValue));
        
        
        request.setHeader('Authorization', authorizationHeader);
        request.setMethod('GET');
        
        HttpResponse response = h.send(request);
        
        
        List<GDPRWrapper.GDPRData> obj = GDPRWrapper.parse(response);
        wrapper = new GDPRWrapper(obj);
         
        System.assert(wrapper.GDPRList!=null);
        updateData(wrapper);
        

      }
      
      
      public static void UpdateData(GDPRWrapper wrapper){
                    List<Contact> contactPref = new List<Contact>();
          
        for(Integer i = 0; i < wrapper.GDPRList.size(); i ++){
            Contact toInsert = new Contact();
            toInsert.firstName = wrapper.GDPRList[i].firstName;
            toInsert.lastName = wrapper.GDPRList[i].lastName;
            toInsert.email = wrapper.GDPRList[i].email;
            
            toInsert.Id = wrapper.GDPRList[i].contactId;
            toInsert.Sales_and_Marketing__c = wrapper.GDPRList[i].marketing;
            toInsert.Critical_Security_Notes__c = wrapper.GDPRList[i].security;
            toInsert.Product_Information__c = wrapper.GDPRList[i].support;
            toInsert.Contact_Via_Text__c = wrapper.GDPRList[i].contactPhone;
            toInsert.Contact_Via_Email__c = wrapper.GDPRList[i].contactEmail;
            contactPref.add(toInsert);
            
          
        
        }
          try{
              insert contactPref;
           
                        
            } 
            catch(DmlException e){
                    System.debug('An unexpected error has occured: ' + e.getMessage());
                }
      
      }
     }
 
public class GDPRWrapper{

    public GDPRWrapper(List<GDPRData> templst){
            GDPRList = templst;
        }
    public List<GDPRData> GDPRList {get; set;}

    public class GDPRData {

        public Integer gdprId {get; set;}  //26636
        public String firstName {get; set;}
        public String lastName {get; set;}
        public String email {get; set;}
        public String phone {get; set;}
        public String accountName {get; set;}
        public String contactId {get; set;}    //AA111222333AAAe
        public String emailHash {get; set;}    //78fcb5ad502033c46d35abcecb3615bd92757fb0451485a19b27b7515f6d82d0
        public String createDate {get; set;}   //2018-05-17T15:19:37.000+0000
        public String responseDate {get; set;} //2018-05-21T10:38:53.000+0000
        public String notifyDate {get; set;}
        public boolean marketing {get; set;}
        public boolean security {get; set;}
        public boolean support {get; set;}
        public boolean contactPhone {get; set;}
        public boolean contactEmail {get; set;}
        public boolean contactOther {get; set;}
        public boolean invalid {get; set;}
        
        
    }
   public static List<GDPRData> parse(httpResponse json){
        return (List<GDPRData>) System.JSON.deserialize(json.getBody(), List<GDPRData>.class);
    }
 
   
        }
        
}
 
trigger GDPR_Prefrences_Updater on Contact (after insert, after update) {
    JSONDeserialize.deserialize();

}

 
Hi ,

I have a scenario where i want to update the lead record's rating field when the status changes to status == 'Closed - Not Converted'.And i wrote after update trigger  for this: Below is the code
 trigger leadUpdate on Lead (after update) {
list<lead> leadUpdate = new List<Lead>();
    for(Lead l :trigger.new){
        if(trigger.oldMap.get(l.id).status != l.status && l.status == 'Closed - Not Converted'){
           lead ld = new lead(id = l.id,rating = 'cold');
            leadUpdate.add(ld); 
        }
    
    }
    update leadUpdate; 
}


And samething can be achieved through  before trigger as well. Below code:
trigger  leadUpdate on Lead (before update) {
List<lead> leadUpdate = new List<Lead>();
if(trigger.isBefore && trigger.isUpdate){
         for(Lead l :trigger.new){
        if(trigger.oldMap.get(l.id).status != l.status && l.status == 'Closed - Not Converted'){
           l.rating = 'cold';
            leadUpdate.add(l); 
        }
    
    }
   
    
    }
}
 
Hello Salesforce,

I'm working through the Trailhead modules and have encountered a problem with completing the "Introduction to Custom Controllers" module.
My solution:

public class NewCaseListController{

public List<Cases> getCases() {
     List<Cases> results = Database.query(        
    'SELECT Id, CaseNumber FROM Cases WHERE Status=New');
      return results;    
                  }
}
I get the error "Illegal assignment from List<SObject> to List<System.Cases> at line 4 column 18" and can't seem to resolve this issue.

Please assist.

Kevin