• Steven Nsubuga
  • ALL STAR
  • 5768 Points
  • Member since 2013
  • Salesforce Developer


  • Chatter
    Feed
  • 180
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 900
    Replies
My Object Acount has a custom field ProfessionalReference__c

When i execute in developer : select id, type,  what.name from task : It's work

When I execute : select id, type, what.ProfessionalReference__c from task.
It doesn't work. Could you please explain ?


Thanks
I'm building a visualforce page for the first time, it's not complete and I'm just playing around with layouts but I'm getting a Syntax Error with no information telling me what the error is, screenshot of the data below. Please help!

Syntax Error
I have the apex class exposed as webservice, but I am not able to generate the WSDL for my Apex class.
Please help me out.
Hi all. i'm trying to create a button that refreshes the child opportunity products when discounts are changed on a opportunity.

The Apex code ges a list of the child opportunity products and updates them.
The Visual Force button runs the method. howveer i get an error saying:

Attempt to de-reference a null object 
An unexpected error has occurred. Your development organization has been notified.


Any idea what I am doing wrong?
Apex Class
PUBLIC CLASS OpportunityProductCostRefreshController 
{
    //add an instance variable for the standard controller
    private ApexPages.StandardController controller {get; set;}
    
    // add the instance for the variables being passed by id on the url
    public opportunity OP {get;set;}
    
    // set the id of the record that is created -- ONLY USED BY THE TEST CLASS
    public ID newRecordId {get;set;}
    
    //Add the variable for the list being queried
    PUBLIC LIST <OpportunityLineItem> GetItemsList {get;set;}   

    // Initialize the controller
    PUBLIC OpportunityProductCostRefreshController(ApexPages.StandardController ctrl)
    {     
        //initialize the standard controller
        this.controller = controller;
        // load the current record
        OP = (Opportunity)controller.getRecord();
    }

    // method called from the VF's action attribute to refreshing the op lines
    public PageReference RefreshOpLines() 
    {
    
        // setup the save point for rollback
        Savepoint sp = Database.setSavepoint();

        TRY
        {
        // Get the list of opportunity line items we want to refresh costs for
        GetItemsList = [
            SELECT Id,OpportunityId, productcode, Quantity, unitprice
            FROM OpportunityLineItem OPL
            WHERE       Opportunityid= :OP.id ORDER BY  productcode ASC
            ];
            {
            UPDATE GetItemsList ;
            return null;
            }
        }
        catch (Exception e){
         // roll everything back in case of error
        Database.rollback(sp);
        ApexPages.addMessages(e);

        }
            
        return new PageReference('/'+OP.id);
    }
}

VF Page
<apex:page standardController="Opportunity"
     extensions="OpportunityProductCostRefreshController"
     action="{!RefreshOpLines}">
     <apex:pageMessages />
</apex:page>

​​​​​​​
trigger RollUpOppAmt on Opportunity (after insert) {
    
    Set<Id> setOpportunityIds=new Set<Id>();
    for(Opportunity o:Trigger.new)
        setOpportunityIds.add(o.id);
    
    List<Account> ListOfAmt = [select id, Amount__c from Account];
    List<Account> lstAmtToUpdate=new List<Account>();
    
    for(AggregateResult result:[SELECT AccountId, SUM(Amount) FROM Opportunity 
                                WHERE Id IN :setOpportunityIds GROUP BY AccountId]) {
        for(Account acc : ListOfAmt) {
            if(result.get('AccountId') == acc.Id) {
                if(acc.Amount__c == null) {
                    acc.Amount__c = 0;
                }
                acc.Amount__c = acc.Amount__c + Decimal.ValueOf(String.ValueOf(result.get('expr0')));
                lstAmtToUpdate.add(acc);
            }
        }
    }
    if(lstAmtToUpdate.size()>0) {
        UPDATE lstAmtToUpdate;
    }
}
Hi all,

May I have some assistance with the below code , this works perfectly if one record is being created but when i create multiple records at the same time I get an error that the List has more than 1 row for assignment to SObject.  

Can someone take a look at what I may be doing wrong. This is the line where the error is originating. 

newSOWrappers.Add(new SOWrapper(shipmentOrder));
 
public class SOWrapper
    {
        public SOWrapper(Shipment_Order__c so, boolean recalculateCosts)
        {
            this.SO = so;
            this.CAP = [SELECT Related_Costing_CPA__c, VAT_Rate__c  FROM CPA_v2_0__c WHERE ID =: so.CPA_v2_0__c];
            this.Client = so.Account__r;

            if (recalculateCosts )
                recalculateCostings();
            else
                buildCostings();
        }

        public SOWrapper(Shipment_Order__c so)
        {
            this.SO = so;
            this.CAP = [SELECT Related_Costing_CPA__c, VAT_Rate__c FROM CPA_v2_0__c WHERE ID =: so.CPA_v2_0__c];
            this.Client = so.Account__r;

            if (so.CPA_v2_0__c != null)

            buildCostings();
        }

        public Shipment_Order__c SO { set; get; }
        public CPA_v2_0__c CAP { set; get; }
        public Account Client { set; get; }
        private List<CPA_Costing__c> relatedCostings;
        private List<CPA_Costing__c> relatedCostingsIOR;
        private List<CPA_Costing__c> relatedCostingsEOR;
        private List<CPA_Costing__c> addedCostings;
        private List<CPA_Costing__c> updatedCostings;

        private Id recordTypeId = Schema.SObjectType.CPA_Costing__c.getRecordTypeInfosByName()
                .get('Display').getRecordTypeId();

        public void buildCostings()
        {
            relatedCostingsIOR = [SELECT Name, Shipment_Order_Old__c, Amount__c, Applied_to__c, Ceiling__c, Conditional_value__c, Condition__c, Floor__c, Cost_Category__c, Cost_Type__c, Max__c, Min__c, Rate__c, CostStatus__c, Updating__c, RecordTypeID, IOR_EOR__c, VAT_applicable__c, Variable_threshold__c, VAT_Rate__c, CPA_v2_0__r.VAT_Rate__c  FROM CPA_Costing__c WHERE CPA_v2_0__c =: CAP.Id AND IOR_EOR__c = 'IOR' ];
            relatedCostingsEOR = [SELECT Name, Shipment_Order_Old__c, Amount__c, Applied_to__c, Ceiling__c, Conditional_value__c, Condition__c, Floor__c, Cost_Category__c, Cost_Type__c, Max__c, Min__c, Rate__c, CostStatus__c, Updating__c, RecordTypeID, IOR_EOR__c, VAT_applicable__c, Variable_threshold__c, VAT_Rate__c, CPA_v2_0__r.VAT_Rate__c  FROM CPA_Costing__c WHERE CPA_v2_0__c =: CAP.Id AND IOR_EOR__c = 'EOR'];       
    
         
         If(SO.Service_Type__c == 'IOR') {
          
            List<CPA_Costing__c>  SOCPAcostingsIOR = relatedCostingsIOR.deepClone();
           
            for(CPA_Costing__c cost : SOCPAcostingsIOR)
            
            {
           
                cost.Shipment_Order_Old__c = SO.ID;
                cost.CPA_v2_0__c = CAP.Related_Costing_CPA__c;
                cost.recordTypeID = recordTypeId;
                cost.VAT_Rate__c =  CAP.VAT_Rate__c;
                
                

                if (SO.Shipment_Value_USD__c != null)
                {
                    cost.Updating__c = !cost.Updating__c;
                    SOTriggerHelper.calculateSOCostingAmount(so, cost, false);
                }
            }
            addedCostings = SOCPAcostingsIOR;
        }
        
        Else If(SO.Service_Type__c == 'EOR') {
          
            List<CPA_Costing__c>  SOCPAcostingsEOR = relatedCostingsEOR.deepClone();
           
            for(CPA_Costing__c cost : SOCPAcostingsEOR)
            
            {
           
                cost.Shipment_Order_Old__c = SO.ID;
                cost.CPA_v2_0__c = CAP.Related_Costing_CPA__c;
                cost.recordTypeID = recordTypeId;
                cost.VAT_Rate__c =  CAP.VAT_Rate__c; 

                if (SO.Shipment_Value_USD__c != null && (SO.FC_Total__c == null || SO.FC_Total__c == 0))
                {
                    cost.Updating__c = !cost.Updating__c;
                    SOTriggerHelper.calculateSOCostingAmount(so, cost, false);
                }
            }
            addedCostings = SOCPAcostingsEOR;
        }
        
        }


         public void recalculateCostings()
        {
            
            relatedCostings = [SELECT Name, Shipment_Order_Old__c, IOR_EOR__c,Amount__c, Applied_to__c, Ceiling__c, Conditional_value__c, Condition__c, Floor__c, Cost_Category__c, Cost_Type__c, Max__c, Min__c, Rate__c, CostStatus__c, Updating__c, RecordTypeID, VAT_Rate__c, VAT_applicable__c, Variable_threshold__c FROM CPA_Costing__c WHERE Shipment_Order_Old__c =: SO.ID];
            System.debug('relatedCostings --- '+relatedCostings.size());
            
            List<CPA_Costing__c> delList = new List<CPA_Costing__c>();
            for(CPA_Costing__c var: relatedCostings )
            {
                if(var.Cost_Type__c == 'Variable'){
                    CPA_Costing__c del = new CPA_Costing__c();
                    del.id =var.id;
                    delList.add(del);                    
                }
            }
            

            
            updatedCostings = new List<CPA_Costing__c>();
            System.debug('updatedCostings --- '+updatedCostings.size());
            List<CPA_Costing__c>  relatedTemplateCPAcostings = [SELECT Name, IOR_EOR__c,Shipment_Order_Old__c, Amount__c, Applied_to__c, Ceiling__c, Conditional_value__c, Condition__c, Floor__c, Cost_Category__c, Cost_Type__c, Max__c, Min__c, Rate__c, CostStatus__c, Updating__c, RecordTypeID, CPA_v2_0__r.VAT_Rate__c, VAT_Rate__c, VAT_applicable__c, Variable_threshold__c FROM CPA_Costing__c WHERE CPA_v2_0__c =: CAP.Id ];
               
               List<CPA_Costing__c> updateCosting = new List<CPA_Costing__c >(); 
               Set<Id> ids = new Set<id>();
              for (CPA_Costing__c templateCost : relatedTemplateCPAcostings)
              {    
               
                  SOTriggerHelper.calculateSOCostingAmount(so, templateCost, false);                       
                  System.debug('The cost id; ----------# '+templateCost.Id+' Amount:- '+templateCost.Amount__c);
                  for(CPA_Costing__c cost : relatedCostings){
                      if (templateCost.Cost_Category__c == cost.Cost_Category__c && templateCost.Name != cost.Name && templateCost.Cost_Type__c == cost.Cost_Type__c && templateCost.Applied_to__c == cost.Applied_to__c && templateCost.IOR_EOR__c == cost.IOR_EOR__c){
                           System.debug(' Do update: '+cost.Id+' the amount '+templateCost.Amount__c+'  --- name '+ templateCost.Name);
                            if(!ids.contains(cost.id) && templateCost.Amount__c > -1){
                                cost.Id = cost.Id;  
                                cost.Name =  templateCost.Name;
                                cost.Amount__c =  templateCost.VAT_applicable__c == TRUE ? templateCost.Amount__c * (1 + (CAP.VAT_Rate__c/ 100)): templateCost.Amount__c;
                                cost.Ceiling__c = templateCost.Ceiling__c;
                                cost.Conditional_value__c = templateCost.Conditional_value__c;
                                cost.Condition__c = templateCost.Condition__c;
                                cost.Cost_Type__c = templateCost.Cost_Type__c;
                                cost.Floor__c = templateCost.Floor__c;
                                cost.Max__c = templateCost.Max__c;
                                cost.Min__c = templateCost.Min__c;
                                cost.Rate__c = templateCost.Rate__c;
                                cost.Variable_threshold__c = templateCost.Variable_threshold__c;
                                cost.VAT_Rate__c = templateCost.CPA_v2_0__r.VAT_Rate__c; 
                                cost.Cost_Category__c   = templateCost.Cost_Category__c ;                                  
                                cost.IOR_EOR__c = templateCost.IOR_EOR__c;                                
                                updateCosting.add(cost);
                                ids.add(cost.id);
                            }
                      }                   
                  }    
              }        
     if(!updateCosting.IsEmpty()){       
        update updateCosting;
     }
            List<CPA_Costing__c> updateCostList = new List<CPA_Costing__c>();
            for(CPA_Costing__c cost : relatedCostings)
            {
                cost.Updating__c = !cost.Updating__c;
                SOTriggerHelper.calculateSOCostingAmount(so, cost, false);
                  System.debug('The cost id; --------'+cost.Id+' Amount:- '+cost.Amount__c);
                  IF(cost.Amount__c == -1){
                                    

                  }
                System.debug(' --- cost '+cost.Amount__c);
                if (cost.Amount__c >= 0)
                {
                System.debug(' --- amount '+relatedTemplateCPAcostings);
                    for (CPA_Costing__c templateCost : relatedTemplateCPAcostings)
                    {
                    
                   
                    System.debug(' --- templateCost ');
                        if (templateCost.Cost_Category__c == cost.Cost_Category__c && templateCost.Name == cost.Name)
                        {
                            cost.Updating__c = !cost.Updating__c;
                            SOTriggerHelper.calculateSOCostingAmount(so, templateCost, false);
                             System.debug(' --- templateCost2  '+templateCost.Amount__c);

                            if (templateCost.Amount__c > 0)
                            {
                             System.debug(' ---inside  '+templateCost.Amount__c);
                                cost.Amount__c =  templateCost.VAT_applicable__c == TRUE ? templateCost.Amount__c * (1 + (CAP.VAT_Rate__c/ 100)): templateCost.Amount__c;
                                cost.Ceiling__c = templateCost.Ceiling__c;
                                cost.Conditional_value__c = templateCost.Conditional_value__c;
                                cost.Condition__c = templateCost.Condition__c;
                                cost.Cost_Type__c = templateCost.Cost_Type__c;
                                cost.Floor__c = templateCost.Floor__c;
                                cost.Max__c = templateCost.Max__c;
                                cost.Min__c = templateCost.Min__c;
                                cost.Rate__c = templateCost.Rate__c;
                                cost.Variable_threshold__c = templateCost.Variable_threshold__c;
                                cost.VAT_Rate__c = templateCost.CPA_v2_0__r.VAT_Rate__c;
                                
                              system.debug('THE COST ' +  cost.ID+' '+cost.Name);  
                                
                            }
                        }
                    }
                }

                updatedCostings.Add(cost);
            }
                       
            if(!updateCostList.IsEmpty()){
                    insert updateCostList;
            }
        }
        
        
        

        public List<CPA_Costing__c> getApplicableCostings()
        {
            List<CPA_Costing__c> applicableCostings = new List<CPA_Costing__c>();
            if (addedCostings != null)
                for (CPA_Costing__c cost : addedCostings)
                    if (cost.Amount__c > -1 && cost.Shipment_Order_Old__c != null)
                        applicableCostings.Add(cost);
            if (updatedCostings != null)
                for (CPA_Costing__c cost : updatedCostings)
                    if (cost.Amount__c > -1)
                        applicableCostings.Add(cost);

            return applicableCostings;
        }
    }

public class CalculateCosts
{

    @InvocableMethod
    public static void createSOCosts(List<Id> SOIds)  
    
    
    {
        List<SOWrapper> newSOWrappers = new List<SOWrapper>();
        List<ID> SOsToUpdate = new List<Id>();
        
        List<Shipment_Order__c> shipmentOrder = [Select Id, Name,  Insurance_Cost_CIF__c, Shipment_Value_USD__c, IOR_Fee_new__c, FC_IOR_and_Import_Compliance_Fee_USD__c, FC_Total_Customs_Brokerage_Cost__c,
        FC_Total_Handling_Costs__c, FC_Total_License_Cost__c, FC_Total_Clearance_Costs__c, FC_Insurance_Fee_USD__c, FC_Miscellaneous_Fee__c, On_Charge_Mark_up__c , FC_International_Delivery_Fee__c,
        TecEx_Shipping_Fee_Markup__c, CPA_v2_0__c, Chargeable_Weight__c, Account__c, Service_Type__c, Total_Taxes__c FROM Shipment_Order__c where id IN :SOIds];
        
        List<Shipment_Order__c> SOs = new List<Shipment_Order__c>();

        List<CPA_Costing__c> costingsToAddUpdate = new List<CPA_Costing__c>();

        List<Shipment_Order__c> updatedSOs =
        [SELECt Id, Name,  Insurance_Cost_CIF__c, Shipment_Value_USD__c, IOR_Fee_new__c, FC_IOR_and_Import_Compliance_Fee_USD__c, FC_Total_Customs_Brokerage_Cost__c,
        FC_Total_Handling_Costs__c, FC_Total_License_Cost__c, FC_Total_Clearance_Costs__c, FC_Insurance_Fee_USD__c, FC_Miscellaneous_Fee__c, On_Charge_Mark_up__c , FC_International_Delivery_Fee__c,
        TecEx_Shipping_Fee_Markup__c, CPA_v2_0__c, Chargeable_Weight__c    FROM Shipment_Order__c  WHERE ID in: SOsToUpdate];
        
        newSOWrappers.Add(new SOWrapper(shipmentOrder));

        if (newSOWrappers.size() > 0 && shipmentOrder.size() > 0 )
       {
            for (SOWrapper wrp : newSOWrappers)
           {
                Shipment_Order__c SO;
               for (Shipment_Order__c SOToUpdate : updatedSOs)
                    if (SOToUpdate.ID == wrp.SO.ID)
                    {
      
        
                    SO = SOToUpdate;
                       break;
          
                  }

               costingsToAddUpdate.AddAll(wrp.getApplicableCostings());
                 
            }
            
           

            
        }
         Upsert costingsToAddUpdate;
        update SOs;
        
        
        
       }
            
                                                   
        
    }

 
parent object: account
fields : contact country - Picklist values: India, Africa, America
child object : contact
field : Contact Area - Picklist values: Karataka, Andhra Pradesh, Kerala, South Africa, Nigeria, Kenya, California, San Fransisco, Texas

when contact is inserted / updated, based the contact's Contact Area field the parents contact Country should change with respected country. wirte a trigger for insert, Update. create required fields.


trigger ConnectA on Contact  (after insert,after update) {

    Map<Id,Contact> AccID = New Map<Id,Contact>();
Map<Id,Contact> oldCOn = trigger.oldMap ; 

    for(Contact con : Trigger.new){
        if( (con.contact_country__c!=oldCOn.get(con.Id).contact_country__c) || 
           (con.Contact_Area__c!=oldCOn.get(con.Id).Contact_Area__c) ){
            AccID.add(con.AccountId);
        }
    }

    List<Account> accList = [SELECT Name, BillingStreet FROM Account WHERE id in :AccID.keySet()];

    for(Account a :accList){
        Contact c = AccID.get(a.Id) ; 
        a.Contact_Area__c = c.Contact_Area__c ; 
        a.contact_country__c = c.contact_country__c ; 
        
    }

    update accList;
}
I want my banner to simply say something that references the picklist option selected (I know I can do this with just visualforce, but would like to add more than the picklist option (for example: "The promotion for this opportunity is: [promo]"), but I keep on getting the  "Content cannot be displayed: SObject row was retrieved via SOQL without querying the requested field: Opportunity.Promotion_Code__c" error. Any help is appreciated. Here's my visualforce and controller code:

VF Code:
 <apex:page standardController="Opportunity" extensions="PartnerPromotionBanner">
  
 <marquee id="banner" rendered="{!Msgid}" style="box-shadow: 0px 0px 15px black; border-radius: 5px; padding: 10px; background-color: #FF0000; font-weight: bolder; font-size: 16px; margin: 10px; color: #FFFFFF font-family:'Lucida'">{!Promo}</marquee>

</apex:page>

Controller Code:
public class PartnerPromotionBanner {
    private final Opportunity opp;
    
     public String showMsg { get; set; }
     public boolean  Msgid { get; set; }
    
     public PartnerPromotionBanner(ApexPages.StandardController stdController) {
     this.opp = (Opportunity)stdController.getRecord();
    }

    
    public string getPromo() {
        if (opp.Promotion_Code__c == 'FinServ Bundle Promo')
        {
            return 'The promotion for this opportunity is: ' + opp.Promotion_Code__c;
        }
        return opp.Promotion_Code__c;
    }
 }
    
 
Hi Team,

We are using trigger for updating count and sum from child to parent object. I am getting issue with one scenario.
Ex :
Parent -  A
Parent - B

Child -1.

Scenario : 1
------------------
Child -1 attached with Parent - A, now its updating Parent - A data.

Scenario : 2
---------------------
Child -1 attached with Parent- A, now i am updating the lookup field with Parent - B, Now Parent - B updating with child data but Parent - A data is not erased still it is showing Child - 1 data (sum and count).

Please let me know how can we resolve this issue.

Code :
----------
public static void rollupSumUpdate(Map<Id, child1__c> newRecs, Map<Id, child1__c> oldRecs){
   
        try{
            
            Set<String> parentIds = new Set<String>();
            
            for(Id chIds : newRecs.keySet()){
                
                child1__c tr = newRecs.get(chIds);
                
                if(tr.parentId__c != Null){
                    
                    parentIds.add(tr.parentId__c);
                    
                    System.debug('******If block -  Update Method - parentIds : **********'+parentIds);
                }
                else
                {
                    parentIds.add(oldRecs.get(chIds).parentId__c);
                    System.debug('******else block -  Update Method - parentIds : **********'+parentIds);
                }
                
            }
            
            Map<Id,parent__c> mapToUpdate = new Map<Id,parent__c>();
            
            if(parentIds.size() > 0){
                
                Map<Id,parent__c> fsOppMap = new Map<Id,parent__c>([Select Id,Amount__c,Trade_Count__c from parent__c where Id In :parentIds]);
                
                parent__c fsOpp = new parent__c();
                
                List<AggregateResult> ar = [Select parentId__c,Count(Id)tradeCount,Sum(Annual_Recurring_Revenue__c)arrSum,Sum(Non_Recurring_Revenue__c)nrrSum 
                                           from child1__c where parentId__c In :parentIds Group By parentId__c];
                System.debug('--------Aggregate Result : '+ar);
                
                If(ar.size() > 0){
                    
                    for(AggregateResult res : ar){
                        
                        Id fsId = (Id)res.get('parentId__c');
                        fsOpp = fsOppMap.get(fsId);
                        
                        fsOpp.Trade_Count__c = (Integer)res.get('tradeCount');
                        System.debug('---Update Method-----Trade Count : '+fsOpp.Trade_Count__c);
                        
                        Decimal arr = (Decimal)res.get('arrSum');
                        System.debug('----Update Method----ARR : '+arr);
                        
                        Decimal nrr = (Decimal)res.get('nrrSum');
                        System.debug('----Update Method----NRR : '+nrr);
                        
                        fsOpp.Amount__c = arr + nrr ;
                        System.debug('----Update Method----Amount : '+fsOpp.Amount__c);
                        
                        mapToUpdate.put(fsOpp.Id,fsOpp);
                        
                    }
                }
                else
                {
                    for(Id ids : parentIds){
                        
                        fsOpp = new parent__c(id = ids); 
                        
                        fsOpp.Trade_Count__c = Null;
                        System.debug('----Update Method--Else Block--Trade Count : '+fsOpp.Trade_Count__c);
                        
                        fsOpp.Amount__c = 0;
                        System.debug('----Update Method--Else Block--Amount : '+fsOpp.Amount__c);
                        
                        mapToUpdate.put(fsOpp.Id,fsOpp);
                        
                    }
                }
                
            }
            
            Database.SaveResult[] res = Database.update(mapToUpdate.values(), false);
            
            
        }
        catch(Exception ex){
            System.debug('---Exception caught in Rollup Sum Update Method :'+ex.getLineNumber());
        }
        
    }
Please let me know any one..

Thanks,
Lakshmi
 
Hi All,

I have submitted  code for security scanning but i got  "SOQL injection issue". Please any one help me to resolve this.
@RemoteAction
     public static string addrecordtothirdparty(string partId, string AuthToken, string instantURL, string recordIds, string IdAndTag, string MappingJSON) {
       
        WrapperClass.Details detailsWrapper = new WrapperClass.Details();
        try {
            map<Id,map<string,string>> recordLstFnl = new map<Id,map<string,string>>();
            list<Contact> conRecLst     = new list<Contact>();
            list<string> recIdsLst = new list<string>();
            map < String, Schema.SObjectField > contactFields = Schema.SObjectType.Contact.fields.getMap();
			map < String, Schema.SObjectField > accountFields = Schema.SObjectType.Account.fields.getMap();	
            list<Account> acntLst = new list<Account>();
            map<string,Account> acntMap = new map<string,Account>();
            map <String, Object> fieldMapping = (map <String, Object>) JSON.deserializeUntyped(MappingJSON);
            list<string> strLst = new list<string>();
            list<string> acntstrLst = new list<string>();
            
            list<string> IdAndTagLst = IdAndTag.split(',');
            string tag = IdAndTagLst[0];
            string Id = IdAndTagLst[1];
            
            recIdsLst = recordIds.split(',');
            
            for( Object str : fieldMapping.values() ) {
            	if( str != 'record_type') {
            		strLst.add(string.valueof(str));	
            	}	
            } 
               
		    string fieldLst = string.join(strLst,',');
		    string Query = 'select '+fieldLst+' from Contact where Id =: recIdsLst ';
		    conRecLst = Database.query(Query);
It is urgent!!!

Thanks in advance!
 
Hey, 

I'm trying to create a narrow chart that will show the color status of an account. Data is populated in a related object weekly. Currently, I'm not getting an error, but nothing is rendering. Debug logs show my query is returning the records. I've never used charts before, so it's probably something silly i've missed. Any thoughts?

Page
<apex:page standardcontroller="Account" extensions="ClientHealthExtension">
    <apex:chart height="125" width="100%" data="{!trendData}">
        <apex:axis type="Numeric" position="bottom" fields="week"/>
        <apex:axis type="Category" position="left" fields="xName"/>
        <apex:barSeries orientation="vertical" axis="bottom" xField="week" yField="xName"/>
    </apex:chart>
</apex:page>

Controller ext.
public class ClientHealthExtension {

    private final Account acct;
    public Account acctName;
    public ID acctId;
    public List<Account> nameList;
    
    public ClientHealthExtension (ApexPages.StandardController stdController){
        this.acct = (Account) stdController.getRecord();
        acctId = acct.Id;
        nameList = [SELECT Name FROM Account WHERE Id=:acctId limit 1];
        if(!nameList.isEmpty()){
            acctName = nameList[0];
        }
    }
    
    public List<Account_Trend__c> gettrendData(){
        List<Account_Trend__c> trends = [SELECT Account_Name__c, Client_Health_Status_Indicator__c, CreatedDate FROM Account_Trend__c WHERE Account_Name__c =:acctName.Name ORDER BY CreatedDate];
        system.debug('trends: '+trends);
        return trends;
    }
    // Wrapper class
    public class trendData {

        public String xName { get; set; }
        public String health { get; set; }
        public date week { get; set; }
        public ID xId { get; set; }
        public String xIso { get; set; }

        public trendData(String xName, String health, date week, ID xId, String xIso) {
            this.xName = xName;
            this.health = health;
            this.week = week;
        }
    }    
}

 
I mentioned my class with respective test class. please let me know where I am doing wrong.

My class is calling in a trigger which fires when my support Request(object) Record is approved by the approver through the standard approval process. when the record is approved the trigger automatically create an Event record. below is the class with test class .

Public class AutoCreateEvent
{
    Public static void createNewEvent(List<DealSupportRequest__c> dsreq, Map<Id, DealSupportRequest__c> oldDsreqMap)
    {
        
        List<Event> EventRec = new List<Event>();
        RecordType SuppReqRecordType = [SELECT Id
                                         FROM RecordType
                                         WHERE SobjectType = 'DealSupportRequest__c' AND DeveloperName = 'PSCUOnsiteSupport'
                                         LIMIT 1];
        for(DealSupportRequest__c ds:dsreq)
        {
            
            if((ds.Is_approved__c==true && ds.RecordtypeId==SuppReqRecordType.Id) && (ds.Is_approved__c !=          oldDsreqMap.get(ds.Id).Is_approved__c) )
            {
               Event e  = new Event();
                e.WhatId = ds.Account__c;
                e.Type   = 'On-Site at PSCU';
                e.Status__c = 'Scheduled';    
                e.OwnerId = ds.Ownerid;
                e.Subject_Custom__c =ds.Purpose__c; 
                e.Description = ds.OtherPurpose__c;
                e.StartDateTime =ds.StartDateTime__c;
                e.EndDateTime = ds.EndDateTime__c;
                e.LocationCallInInfo__c = ds.CampusLocation__c;
                e.Support_Request__c = ds.Id;
                EventRec.add(e);
              
          }
      }
        If(EventRec.size()>0)
        Insert EventRec;
    }
}

Test class:
@IsTest
public class AutoCreateEvent_Test {

    static testmethod void  CreateEvent(){
      Test.startTest();
        
            User u = new User(
            ProfileId = [SELECT Id FROM Profile WHERE Name = 'System Administrator'].Id,
            LastName = 'last',
            Email = 'puser000@amamama.com',
            Username = 'puser000@amamama.com' + System.currentTimeMillis(),
            CompanyName = 'TEST',
            Title = 'title',
            Alias = 'alias',
            TimeZoneSidKey = 'America/Los_Angeles',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            LocaleSidKey = 'en_US',
            EmployeeNumber='1'
        );
        insert u;
        List<Event> EventRec = new List<Event>();
    
        Account a = new Account(Name='1st Community CU',Membership_Defined__c='Member',Type='Client', ownerid=u.id );
        Insert a;
    
        DealSupportRequest__c dsr = new      DealSupportRequest__c(Account__c=a.Id,StartDateTime__c=system.now(),EndDateTime__c=system.now().addDays(1),ownerid=a.Ownerid);
        Insert dsr;
        
         Event e = new Event();
            e.WhatId=a.Id;
            e.Type   = 'On-Site at PSCU';
            e.Status__c = 'Scheduled';
            e.OwnerId = dsr.Ownerid;
          //  e.Support_Request__c=dsr.Id;
            e.StartDateTime =dsr.StartDateTime__c;
            e.EndDateTime = dsr.EndDateTime__c;
            EventRec.add(e);
        
        insert EventRec;
    Test.stopTest() ;   
    }
}