• Amit Ghadage
  • NEWBIE
  • 214 Points
  • Member since 2015

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 55
    Replies
Hello,
I am trying to perform the following
  • Hide commandbutton unless a picklist value has been selected
  • Hide panelgrid until commandbutton has been clicked.
Here is my VF page:
<apex:page standardStylesheets="true"  showHeader="True" sidebar="true" Controller="AccountDealerController" >
  <apex:form >
       <apex:pageBlock title="Select an Account">
        
        <apex:outputpanel id="Outputtext">
        <apex:outputtext value="{!fieldValue}"/>
        </apex:outputpanel>
        
            <apex:selectList value="{!selectedFields}" size="1">
                <apex:selectOptions value="{!AccountNames}" />
                <apex:actionSupport event="onchange"  reRender="values" action="{!passValueToController}"/>              
           </apex:selectList><br/><br/>  
        <apex:outputText value="{!fieldValue}" label="You have selected:" id="values" /> <!--  used to verify Id -->           
       </apex:pageBlock>  
      
      <apex:commandButton value="See Charts" reRender="chart"/><br/>

        <apex:outputPanel id="chart">
        <apex:outputPanel rendered="{!fieldValue}">

                <apex:panelGrid columns="3" id="theGrid">
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
               </apex:panelGrid>
           </apex:outputPanel>
      </apex:outputPanel>  
    </apex:form>
</apex:page>
Suggestions are greatly appreiated.
M
 
Hello,

I am new to salesforce development, can any one help on this?

Q: I want vf page pageblocktable should contain 3 columns, in that first two columns is from custom object and values for this columns is pulled from custom object. And 3rd column is result(SUM) of 1st and 2nd column(3rd column doesnt belong to custom object, it is independent column which is used to display result only)? Need help to create this process.


Regards,
Ram

 
  • October 19, 2016
  • Like
  • 0
Hi,

I want to get all the values of a multi select picklist custom field, no matter what values are selected through apex code. Can anyone tell me how could I approach this? 
Hi All,

I am very new to programming and I am trying to takle my first challenge...

I need to create a trigger which check/uncheck a checkbox on the contact record when a checkbox is checked/unchecked on a custom object. 

The custom object has a child relationship with Contact object. 

I have Ok_to_Welcome_Email__c on both custom object and Contact object - they should basically get synced, the custom object will be the master for the syncronization.

following anothe post, I've written the following code which clearly does not work:
 
trigger updateOkToWelcomeEmail on CustomObject__c (before insert, before update) {   
    List<Contact> ContactList = new List<Contact>();
    List<Id> contactId        = new List<Id>();
        For(CustomObject__c fa : Trigger.new) {
           if(fa.ok_to_welcome_email__c = True) {
               contactId.add(fa.Contact__c);
                }
                }
contactList = [SELECT Id, ok_to_welcome_email__c FROM Contact WHERE Contact__c IN : contactId];
    for(Contact l : contactList) {
        l.ok_to_welcome_email__c = true;
        }
        update contactList;
}





 

Hi,

I have created an approval process for a custom object called Offer which is based on several selections regarding the creation of the offer.
The offer is to be locked and sent to a manager for approval when the criteria is
Price <0.200 and Region= NI
What I have realised is that when the offer is created the approval won't start - the user has to press the Submit for Approval for it to start.

Is it possible to create a trigger to kick the approval process off automatically when the offer has been created?

Hello, I am testing a Trigger which calculates and fill a few custom fields (type currency), then saves in local variables the values calcutated by the trigger. After that I modify a few fields so the trigger executes again, to finally compare old values with the new ones. The assert lines fail because of null values are equal.

This code is in the test class:
//Create the object
        Cotizacion__c coti = new Cotizacion__c();
            coti.Propuesta__c = p.Id;
            coti.Descuento__c = 0;
            coti.CurrencyIsoCode = 'CLF';
        insert coti;
        
        System.debug('Coti Name: '+ coti);
     
//Create a child object which is modified later
        Linea_CotizacionNom__c l1 = new Linea_CotizacionNom__c();
            l1.Cotizacion__c = coti.Id;
            l1.Rol__c = 'L1';
            l1.Tipo_Asignacion__c = 'HH';
            l1.Cargo_del_Rol__c = 'Director de Proyectos';
            l1.Dedicacion__c = 25;
            l1.Meses__c= 4;
        insert l1;

        //Guardar valores antes del cambio para comparar.
        //SAves locally old values before update.

        double tarifaSugerida = l1.Tarifa_Sugerida_v2__c;  
        double CostoRolV2 = l1.Costo_Rol_v2__c;
        double CostoTmP= l1.Costo_Linea_Nomina_tmp__c;
        double CostoLineaNomina = l1.Costo_Linea_Nomina__c;
        
        System.debug(LoggingLevel.INFO, '[TEST] ---MODIFICA LINEA]');
        l1.Tipo_Asignacion__c = 'Mes';
        l1.Rol__c= 'L2';
        l1.Cargo_del_Rol__c = 'Gerente de Proyectos';
        l1.Dedicacion__c = 50;
        l1.Meses__c= 3;       
        update l1;

        System.debug(LoggingLevel.INFO, '[TEST] ---MODIFICA LINEA: GRABADO --> VALORES NUEVOS]');
        
        System.debug(LoggingLevel.INFO, '[TEST] L1 Modif:]'+ l1);
        
        //comparo si han cambiado los campos calculados.
        System.assertNotEquals(l1.Tarifa_Sugerida_v2__c,tarifaSugerida);
        System.assertNotEquals(l1.Costo_Rol_v2__c,CostoRolV2);
        System.assertNotEquals(l1.Costo_Linea_Nomina_tmp__c,CostoTmP);        
        System.assertNotEquals(l1.Costo_Linea_Nomina__c,CostoLineaNomina);

The weird thing is after saving the object, I do get an ID, but the Name field logs a NULL value.
Name is a an auto numbered field.

Questions:
1. Does anyone can see why I am getting null values in the Name of object l1 ?
2. How can I do some debug with breakpoint as I used tod do before the Interactive Apex Debugger was released? I use Eclipse.

Ignacio
Thanks you!

 
I need to iterate over list of dynamic components on visualforce page but its not working.
I tried with apex:repeat and apex:pageBlocktable tags on vf, With transient keyword and without transient keyword.

vf page
<apex:page StandardController="Account" extensions="testDynamicComponent "> <apex:form>
 <apex:pageBlock>
 <apex:repeat value = "{!dynamicComponents}" var = "d">
 <apex:dynamicComponent componentValue = "{!d}"/>
 </apex:repeat >
 </apex:pageBlock> 
</apex:form> 
</apex:page>

Controller
public class testDynamicComponent {

    public testDynamicComponent(ApexPages.StandardController controller) {

    }

   public List<Component.Apex.InputField> getdynamicComponents()
    {
            List<Component.Apex.InputField> inputFieldList = new List<Component.Apex.InputField>();

            transient  Component.Apex.InputField inpField= new Component.Apex.InputField();
            inpField.expressions.value = '{!Account.Name}';
            inputFieldList.add(inpField);

            transient  Component.Apex.InputField inpFldIndus = new Component.Apex.InputField();
            inpFldIndus.expressions.value = '{!Account.Industry}';
            inputFieldList.add(inpFldIndus);

            return inputFieldList;
    }

}


 
I want to render a table dynamically in lightning. I have a list of data of transaction (Custom object) and list of string which contains API name which data i want to render.
I have created a child component and wrapped it in nested aura iteration to display the data. But I am unable to access the value.
 
aura:iteration items="{!v.Transactions}" var="trans">
       <tr>
       <aura:iteration items="{!v.fieldNames}" var="field" indexVar="ind">
         <td><c:TransactionOutputField object="{!trans}" fieldName="{!field}"/></td>
       </aura:iteration>
       </tr>
     </aura:iteration>


child component
___________________

 
<aura:component>
  <aura:attribute name="object" type="Object" />
  <aura:attribute name="fieldName" type="String" />
  <aura:attribute name="fieldVal" type="String" access="private" />
  <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>

  {!v.fieldVal}
</aura:component>


controller
__________
 
({
    myAction : function(component, event, helper) {

        var obj = component.get("{!v.object}");
        var field = component.get("{!v.fieldName}");

        console.log(JSON.stringify(obj));
        console.log(field);

        var value = obj.field;
        console.log(value);

        component.set("v.fieldVal", value);

    }
})


debug value in the obj :
 
{"Id":"a0l1q000000BYLQAA4","Name":"0002000332","akritiv__Amount__c":0,"akritiv__Balance__c":0,"akritiv__Source_System__c":"SAPG","akritiv__Batch_Number__c":"20181003124027"}


debug value in the field :
 
akritiv__source_system__c




 
I have a very simple Lightining component included in Chatter of a case record, and I am trying to get the recordId of the case, but its coming as 'undefined'. As per the docs, I have implemented force:hasRecordId marker interface. 

Component:
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
    <!-- recordId is always empty here -->
    Record Id is =====> {!v.recordId}
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>

Controller:
({
    doInit: function(component, event, helper) {
        console.log(component.get("v.recordId"));  //debug console shows 'undefined' here
    } 
})
Is there anything I am missing here? Thanks in advance.
 
I have been all over, and I don't understand.  What is it asking for, parent ID of what?  What am I missing here.  Thank you.
My code is as follows:

global class BatchSyncErrors implements Database.Batchable<sOBject>, Database.Stateful{
   
    global string excelHeader = 'ApexClassID,  CompletedDate ,  ExtendedStatus,  JobItemsProcessed,  JobType,  MethodName,  NumberOfErrors,  Status,  TotalJobItems \n';
    global string finalstr = '';
    
    //constructor
    global BatchSyncErrors(){
        finalstr = excelHeader;
    }
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator('SELECT ApexClassID, CompletedDate, ExtendedStatus, JobItemsProcessed, JobType, MethodName, NumberOfErrors, Status, TotalJobItems FROM AsyncApexJob Limit 10');
    }
 
    //execute
        global void execute(Database.BatchableContext BC, List<sOBject> scope){

            string recordString;
        
            for(sOBject a: scope){
        
                // Type Cast sOBject to AsyncApexJob
                AsyncApexJob asyncApexJobRecord = (AsyncApexJob) a;
                   
                if(recordString == NULL){
                    recordString = AsyncApexJobRecord.ApexClassID +',' + AsyncApexJobRecord.CompletedDate +','+ AsyncApexJobRecord.ExtendedStatus+',' + AsyncApexJobRecord.JobItemsProcessed + ',' + AsyncApexJobRecord.JobType +  ',' + AsyncApexJobRecord.MethodName + ',' + AsyncApexJobRecord.NumberOfErrors + ',' + AsyncApexJobRecord.TotalJobItems + ','+ AsyncApexJobRecord.JobItemsProcessed + ',' +AsyncApexJobRecord.JobType + ',' + AsyncApexJobRecord.TotalJobItems+ '\n';
                } else {
                    recordString += AsyncApexJobRecord.ApexClassID +',' + AsyncApexJobRecord.CompletedDate +','+ AsyncApexJobRecord.ExtendedStatus+',' + AsyncApexJobRecord.JobItemsProcessed + ',' + AsyncApexJobRecord.JobType +  ',' + AsyncApexJobRecord.MethodName + ',' + AsyncApexJobRecord.NumberOfErrors + ',' + AsyncApexJobRecord.TotalJobItems + ','+ AsyncApexJobRecord.JobItemsProcessed + ',' +AsyncApexJobRecord.JobType + ',' + AsyncApexJobRecord.TotalJobItems+ '\n';
                }
        
            }
        
            finalstr += recordString;

}

    
    //finish
    global void finish (Database.BatchableContext BC){
       
        system.debug('**** Final String *** ' + finalstr);
        //TODO: pass this string to create CSV in your CSV Method.
            String csvContent = finalstr;
                Attachment attachment = new Attachment();
                attachment.Body = Blob.valueOf(csvContent);
                attachment.Name = 'csvFile.csv';
              
                insert attachment;
       
         //TODO: Create an generic method to send emails & pass this attachment.
         
        AsyncApexJob a = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email,ExtendedStatus,JobType,ApexClassId,MethodName
      FROM AsyncApexJob WHERE Id =
      :BC.getJobId()];
            
        Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
            mail.setToAddresses((new String[] {'test@test.com'}));
            //mail.setReplyTo('noreply@privatebudget.com');
            mail.setSenderDisplayName('Batch Class Errors');
            mail.setSubject('Batch Class Errors');
            mail.setBccSender(false);
            mail.setUseSignature(false);
            mail.setPlainTextBody(finalstr);
            system.debug('@@@@ sendEmail - mail : ' + mail);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
 
    }
}


and the email received is:


Apex script unhandled exception by user/organization: 00518000001WfNj/00D180000008oBS
Source organization: 00D300000006IaD (null)
Failed to process batch for class 'BatchSyncErrors' for job id '7071800000gWEFg'

caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ParentId]: [ParentId]

Class.BatchSyncErrors.finish: line 48, column 1

Debug Log:
40.0 APEX_CODE,DEBUG;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINE;VALIDATION,INFO;VISUALFORCE,FINER;WAVE,FINEST;WORKFLOW,FINER
15:56:02.0 (258843)|USER_INFO|[EXTERNAL]|00518000001WfNj|all60388@adobe.com.signstage|Pacific Standard Time|GMT-07:00
15:56:02.0 (290487)|EXECUTION_STARTED
15:56:02.0 (294740)|CODE_UNIT_STARTED|[EXTERNAL]|01p18000000BBrV|BatchSyncErrors
15:56:02.0 (11144677)|SYSTEM_METHOD_ENTRY|[41]|System.debug(ANY)
15:56:02.0 (11171785)|USER_DEBUG|[41]|DEBUG|**** Final String *** ApexClassID,  CompletedDate ,  ExtendedStatus,  JobItemsProcessed,  JobType,  MethodName,  NumberOfErrors,  Status,  TotalJobItems 
01p18000000BBrVAAW,2017-09-08 17:16:32,null,1,BatchApex,null,0,1,1,BatchApex,1
null,null,null,0,ApexToken,null,0,0,0,ApexToken,0
01p1800000062WPAAY,2017-09-07 15:20:29,null,1,BatchApex,null,0,1,1,BatchApex,1
null,null,null,0,ApexToken,null,0,0,0,ApexToken,0
null,null,null,0,ApexToken,null,0,0,0,ApexToken,0
01p180000005zyLAAQ,2017-09-03 06:00:26,null,1,BatchApex,null,0,1,1,BatchApex,1
01p180000005zyLAAQ,2017-09-03 06:00:17,null,1,BatchApexWorker,null,0,1,1,BatchApexWorker,1
01p18000000BBrVAAW,2017-09-07 20:51:59,null,1,BatchApex,null,0,1,1,BatchApex,1
null,null,null,0,ApexToken,null,0,0,0,ApexToken,0
01p18000000BBrVAAW,2017-09-07 19:46:50,null,1,BatchApex,null,0,1,1,BatchApex,1

15:56:02.0 (11190603)|SYSTEM_METHOD_EXIT|[41]|System.debug(ANY)
15:56:02.0 (11352022)|SYSTEM_METHOD_ENTRY|[45]|Blob.valueOf(String)
15:56:02.0 (11392106)|SYSTEM_METHOD_EXIT|[45]|Blob.valueOf(String)
15:56:02.0 (11548575)|DML_BEGIN|[48]|Op:Insert|Type:Attachment|Rows:1
15:56:02.0 (11562050)|LIMIT_USAGE|[48]|DML|1|150
15:56:02.0 (11575389)|LIMIT_USAGE|[48]|DML_ROWS|1|10000
15:56:02.0 (425072145)|CODE_UNIT_STARTED|[EXTERNAL]|01q40000000Td0s|AttachmentTrigger on Attachment trigger event BeforeInsert for [new]
15:56:02.0 (425366692)|SYSTEM_METHOD_ENTRY|[13]|Limit.getLimitQueries()
15:56:02.0 (425414605)|SYSTEM_METHOD_EXIT|[13]|Limit.getLimitQueries()
15:56:02.0 (425428037)|SYSTEM_METHOD_ENTRY|[13]|Limit.getQueries()
15:56:02.0 (425434866)|SYSTEM_METHOD_EXIT|[13]|Limit.getQueries()
15:56:02.0 (425440962)|SYSTEM_METHOD_ENTRY|[13]|Limit.getLimitDmlRows()
15:56:02.0 (425445832)|SYSTEM_METHOD_EXIT|[13]|Limit.getLimitDmlRows()
15:56:02.0 (425451753)|SYSTEM_METHOD_ENTRY|[13]|Limit.getDmlRows()
15:56:02.0 (425455759)|SYSTEM_METHOD_EXIT|[13]|Limit.getDmlRows()
15:56:02.458 (458339540)|CUMULATIVE_LIMIT_USAGE
15:56:02.458 (458339540)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 200
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 1 out of 10000
  Maximum CPU time: 0 out of 60000
  Maximum heap size: 0 out of 12000000
  Number of callouts: 0 out of 0
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 0
  Number of queueable jobs added to the queue: 0 out of 1
  Number of Mobile Apex push calls: 0 out of 10

15:56:02.458 (458339540)|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
15:56:02.458 (458339540)|STATIC_VARIABLE_LIST|
  char[]:DigitTens:0
  long:serialVersionUID:0
  long:serialVersionUID:0
  String:_sfdcAdditionalCodeLocations:0
  String:__sfdcParameterizedTypes:0
  double:MAX_VALUE:0
  Boolean:FALSE:0
  long:serialVersionUID:0
  String:_sfdcSuppressedCodeLocations:0
  double:MIN_VALUE:0
  int:SIZE:0
  double:NEGATIVE_INFINITY:0
  int:MAX_VALUE:0
  String:_sfdcAdditionalCodeLocations:0
  char[]:digits:0
  double:NaN:0
  Boolean:TRUE:0
  String:_sfdcAdditionalCodeLocations:0
  int:MIN_VALUE:0
  char[]:DigitOnes:0
  String:_sfdcAdditionalCodeLocations:0
  int:BYTES:0
  int:MIN_EXPONENT:0
  int[]:sizeTable:0
  int:MAX_EXPONENT:0
  int:SIZE:0
  double:POSITIVE_INFINITY:0
  double:MIN_NORMAL:0
  int:BYTES:0

15:56:02.458 (458339540)|CUMULATIVE_LIMIT_USAGE_END

15:56:02.0 (459420821)|CODE_UNIT_FINISHED|AttachmentTrigger on Attachment trigger event BeforeInsert for [new]
15:56:02.0 (470961184)|DML_END|[48]
15:56:02.0 (471029439)|EXCEPTION_THROWN|[48]|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ParentId]: [ParentId]
15:56:02.0 (471405705)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ParentId]: [ParentId]

Class.BatchSyncErrors.finish: line 48, column 1
15:56:02.531 (531444350)|CUMULATIVE_PROFILING_BEGIN
15:56:02.531 (531444350)|CUMULATIVE_PROFILING|No profiling information for SOQL operations
15:56:02.531 (531444350)|CUMULATIVE_PROFILING|No profiling information for SOSL operations
15:56:02.531 (531444350)|CUMULATIVE_PROFILING|DML operations|
Class.BatchSyncErrors.finish: line 48, column 1: Insert: Attachment: executed 1 time in 460 ms

15:56:02.531 (531444350)|CUMULATIVE_PROFILING|method invocations|
External entry point: global void finish(Database.BatchableContext): executed 1 time in 460 ms
External entry point: public void invoke(): executed 1 time in 33 ms
Class.AttachmentTriggerHandler.executeOperations: line 19, column 1: private static void onBeforeInsert(List<Attachment>): executed 1 time in 0 ms
Class.BatchSyncErrors.finish: line 41, column 1: global public static void debug(ANY): executed 1 time in 0 ms
Class.BatchSyncErrors.finish: line 45, column 1: public static Blob valueOf(String): executed 1 time in 0 ms
Trigger.AttachmentTrigger: line 13, column 1: global public static Integer getLimitQueries(): executed 4 times in 0 ms
Trigger.AttachmentTrigger: line 14, column 1: public static void executeOperations(List<Attachment>, List<Attachment>, Map<Id,Attachment>, Map<Id,Attachment>, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean): executed 1 time in 0 ms

15:56:02.531 (531444350)|CUMULATIVE_PROFILING_END
I need to write an apex class to do a batch update on activities.  My question is do I need to query Tasks and Events seperately in my class like I would if were using the workbench or can I query all the activites together?  If so how.  I will be writing a batch class to update basically all of our open and closed actvities to update some new lookup fields we recently added.
Hello,
I am trying to perform the following
  • Hide commandbutton unless a picklist value has been selected
  • Hide panelgrid until commandbutton has been clicked.
Here is my VF page:
<apex:page standardStylesheets="true"  showHeader="True" sidebar="true" Controller="AccountDealerController" >
  <apex:form >
       <apex:pageBlock title="Select an Account">
        
        <apex:outputpanel id="Outputtext">
        <apex:outputtext value="{!fieldValue}"/>
        </apex:outputpanel>
        
            <apex:selectList value="{!selectedFields}" size="1">
                <apex:selectOptions value="{!AccountNames}" />
                <apex:actionSupport event="onchange"  reRender="values" action="{!passValueToController}"/>              
           </apex:selectList><br/><br/>  
        <apex:outputText value="{!fieldValue}" label="You have selected:" id="values" /> <!--  used to verify Id -->           
       </apex:pageBlock>  
      
      <apex:commandButton value="See Charts" reRender="chart"/><br/>

        <apex:outputPanel id="chart">
        <apex:outputPanel rendered="{!fieldValue}">

                <apex:panelGrid columns="3" id="theGrid">
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
                    <analytics:reportChart showRefreshButton="false"  reportId="AAAAAA" filter="[{column:'ACCOUNT_ID',operator:'equals',value:'{!fieldValue}'}]" size="small"> </analytics:reportChart>
               </apex:panelGrid>
           </apex:outputPanel>
      </apex:outputPanel>  
    </apex:form>
</apex:page>
Suggestions are greatly appreiated.
M
 
I had saved Account record,lets us assume,i had related record for Contact,Opportunity and case.Based on Account Id i have to get the related records,but i dont want to hard select id from Contact,Opportunity,Case like.00136000011558cAAA this is my id,help me out ,,thanks in advance.
Hi everyone,
Today I faced a problem using SQL queries in production environment to update
The query is the following :
PDATE Contact SET Converted_Month__c = date(year(CreatedDate),month(CreatedDate),1) WHERE ID = 'XYZ'
I tried to execute query above using the SQL panel in Develop tools. BUT I get this message : The query has to start with 'FIND' or 'SELECT'.
One more question, the statement Select * seems blocked by SFDC, is there any technical restriction behind it? if yes, is there a workaroud or a solution to select all fields in a given table?
Your helps is appreciate 
Hi All,

I have a trigger to assign Contacts by criteria-based-Round Robin based on Project and Language parameters. The below code query was returning values as long as the Projects field was a picklist, now after I've converted it into a multipicklist, it doesn't seem to return any values. Please asist
 
trigger AssignSalesmanager on contact(before insert , after update)
{
    String currentuser = [Select alias From User Where Id = :UserInfo.getUserId()].alias;
            system.debug(currentuser);
            if(currentuser == 'guest' || currentuser == 'oadmi')
            {
    if(Trigger.isBefore)
    {
        if(Trigger.IsInsert)
        {
            Map<String,List<round_robin__c>> mapOfLangUsers = new  Map<String,List<round_robin__c>>();
            Map<String,List<round_robin__c>> mapOfProjUsers = new  Map<String,List<round_robin__c>>();
           
            map<string,list<contact>> MapoflangandContacts = new map<string,list<contact>>();
            map<string,list<contact>> MapofprojandContacts = new map<string,list<contact>>();
            Set<String> projectValues = new Set<String>();
            String projValues;
            Set<String> langValues = new Set<String>();
            List<Contact> allContacts = new List<contact>();
            Boolean hasModifiedUser = false;
            for(contact eachcontact: trigger.new){
  
               if(!String.isBlank(eachcontact.Language__c) && !String.isBlank(eachcontact.Projects__c)) {
                   allContacts.add(eachcontact);
                   langValues.add(eachcontact.language__c);
                   projectValues.add(eachcontact.projects__c);
                   projvalues= String.valueOf(projectValues);
                     
               }     
             
            }
            
            if(MapoflangandContacts.size() > 0 && MapoflangandContacts!= null) {
            for(string strlang : MapoflangandContacts.keyset()){
                integer i=0;
                for(Contact objContact : MapoflangandContacts.get(strlang)){
                    objContact.ownerid = mapOfLangUsers.get(objContact.Language__c)[i].Round_Robin_User__c;
                    mapOfLangUsers.get(objContact.Language__c)[i].Count__c = mapOfLangUsers.get(objContact.Language__c)[i].Count__c+1;
           
                    i++;
                if(i==mapOfLangUsers.get(objContact.Language__c).size())
                    i=0;
                }
            } 
           
            list<round_robin__c> lstrb = new list<round_robin__c>();
    
            for(list<round_robin__c> lstuser : mapOfLangUsers.values()){
                lstrb.addall(lstuser);
            }  
            update lstrb; 
           
           }
           if(MapofprojandContacts.size() > 0 && MapofprojandContacts!= null) {
               for(string strProject : MapofprojandContacts.keyset()){
                    integer i=0;
                    for(Contact objContact : MapofprojandContacts.get(strProject)){
                        objContact.ownerid = mapOfProjUsers.get(objContact.Projects__c)[i].Round_Robin_User__c;
                        mapOfProjUsers.get(objContact.Projects__c)[i].Count__c = mapOfProjUsers.get(objContact.Projects__c)[i].Count__c+1;
               
                        i++;
                    if(i==mapOfProjUsers.get(objContact.Projects__c).size())
                        i=0;
                    }
                } 
           
                list<round_robin__c> lstrb = new list<round_robin__c>();
        
                for(list<round_robin__c> lstuser : mapOfProjUsers.values()){
                    lstrb.addall(lstuser);
                }  
                update lstrb; 
           }
          
           if(allContacts.size() > 0 && allContacts!=null) {
           Integer recordCount = [select count() from contact];
           system.debug('recordCount='+recordCount);
           Integer rr = [select Count() from round_robin__c where Is_Active__c = TRUE AND Language__c IN:langValues AND Projects__c INCLUDES (:projvalues)   ];
             system.debug('rr='+rr);
             if(rr!=0)
           {
             Integer index = Math.mod(recordCount+1,rr);
            
           list <round_robin__c> lstRoundSpecificUsers  = [select id,name,Count__c,Round_Robin_User__c,Language__c,Projects__c from round_robin__c where Is_Active__c = TRUE AND Language__c IN:langValues AND Projects__c INCLUDES (:projvalues)   ];
               system.debug(lstRoundSpecificUsers  );
               Integer i;
               IF(i==null)
               {i=0;}

               for(contact eachContact : trigger.new) {
                   
                       system.debug('index='+index);
                     eachContact.ownerId = lstRoundSpecificUsers[index].Round_Robin_User__c;
              
                   
               }
               }  
           } 
        } 
      
     }   
     }
    
   if(trigger.isUpdate) { 
       System.debug('----->Entered');
        Map<Id,Id> mapOfContact = new Map<Id,Id>();
        for(Contact con: trigger.new)
         {
             
           if(con.OwnerId != trigger.oldmap.get(con.id).ownerId)
           {
               System.debug('----->Entered111');
              mapOfContact.put(con.Id,con.OwnerId);
          }
        }
        list<pba__Request__c> lstRequest = [select id,name,Contact_Owner__c,pba__Contact__c from pba__Request__c where pba__Contact__c IN:mapOfContact.keySet() ];
        if(lstRequest.size() > 0) {
            for(pba__Request__c eachReq : lstRequest) {
                eachReq.OwnerId = mapOfContact.get(eachReq.pba__Contact__c);
            }
        }
        update lstRequest;
    }
}


The system.debug statement for vairable rr keeps returning as 0 if I compare it with a set of values. It returns rows if I hardcode the values, which I don't want to. I want this to be dynamic.

How do i work around this.

Thanks,

Avinash

Apex Class:
-----------------
public class OppsController {

    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null){
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT name, type, amount, closedate FROM Opportunity]));
                setCon.setPageSize(5);
            }
            return setCon;
        }
        set;
    }
    
    public List<Opportunity> getOpportunities(){
        return (List<Opportunity>) setCon.getRecords();
    }
}

Visualforce Page:
-------------------------
<apex:page controller="OppsController" >
    <apex:chart data="{!Opportunities}" height="400" width="600">
        <apex:axis type="Category" position="left" fields="name" title="Opportunities" />
        <apex:axis type="Numeric" position="bottom" fields="amount" title="Amount" />
        <apex:barSeries orientation="horizontal" axis="bottom" xField="name" yField="amount" />
    </apex:chart>
    <apex:dataTable value="{!Opportunities}" var="opp" >
        <apex:column headerValue="Opportunity" value="{!opp.name}" />
        <apex:column headerValue="Amount" value="{!opp.amount}" />
    </apex:dataTable>
</apex:page>
Hello,

I am new to salesforce development, can any one help on this?

Q: I want vf page pageblocktable should contain 3 columns, in that first two columns is from custom object and values for this columns is pulled from custom object. And 3rd column is result(SUM) of 1st and 2nd column(3rd column doesnt belong to custom object, it is independent column which is used to display result only)? Need help to create this process.


Regards,
Ram

 
  • October 19, 2016
  • Like
  • 0

I have a current Apex class in my production, I would like to do a simple tweek to one of the labels used in the Public Group.

I have done the simple change on Sandbox, and its working on Sandbox.

Somehow, I would like to do the same for my Production, but i cannot. I'm not familiar with Apex coding, but i remember it needs some deployment steps from Sandbox into Production.

I need all the guidance as I can get on this.... Any step by step guide would be really great!

What is wrong with this trigger , it is not working . 
trigger RestrictContactByName on Contact (before insert,before update) {
  
List<Contact> cons = [Select Id from Contact where (Id IN :Trigger.New)];
    for (Contact c : cons)   {
        
        if(c.LastName == 'INVALIDNAME') 
             {
           
            c.AddError('The Last Name "'+c.LastName+'" is not acceptable');
              }

    }

    }

 
I need to be able to remove the Setup->App Setup->Develop as well as the Setup->App Setup->Deploy options from the Setup menu for a certain User profile while still allowing that profile to access Setup->App Setup->Customize and Setup->App Setup->Create options. I can't find which Profile settings will do that for me.

Thanks!
Hi,

I want to get all the values of a multi select picklist custom field, no matter what values are selected through apex code. Can anyone tell me how could I approach this? 
Hi! I need to write a code using dynamic SOQL query that if I enter either an Account's Name or Phone or Website (any of the three) that Account should be displayed. 
Hi,

I want to create button on standard page as show in image(Red color). If this is possible then provide me steps with some example.

Thanks
User-added image
Hi Team,

We have created Two batch classes using different objects(Account and Opportunity) for updating the Teammembrs which are working fine.But my problem is i want to include onebatch class instead of two batch class.Can any one please help on this.

Thanks