• Lakshmi S
  • SMARTIE
  • 574 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 9
    Likes Received
  • 0
    Likes Given
  • 121
    Questions
  • 105
    Replies
I am not getting any selectd options in the SelectOption list to show on my Visual Force page. Beow is the VF snippet and controller.

Example
public class sampleConSubmissions {
    
     String[] submissions = new String[]{};

    public sampleConSubmissions(ApexPages.StandardController controller) {

    }
        
            
        public PageReference test() {
            return null;
        }
            
        public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('TR00025712016 - Umbr only','TR00025712016 - Umbr only'));
            options.add(new SelectOption('TR00028982016 - Casualty','TR00028982016 - Casualty'));
            options.add(new SelectOption('TR18622016 - Casualty','TR18622016 - Casualty'));
            options.add(new SelectOption('TR20612016 - Property','TR20612016 - Property'));
            return options;
        }
            
        public String[] getsubmissions() {
            return submissions;
        }
            
        public void setsubmissions(String[] submissions) {
            this.submissions = submissions;
        }
    }
 
<apex:selectList value="{!submissions}" multiselect="true">
            <apex:selectOptions value="{!items}"/>
        </apex:selectList><p/>

        <apex:commandButton value="Select Submissions" action="{!test}" rerender="out" status="status"/>
    

    <apex:outputPanel id="out">
        <apex:actionstatus id="status" startText="testing...">
            <apex:facet name="stop">
                <apex:outputPanel >
                    <p>You have selected:</p>
                    <apex:dataList value="{!submissions}" var="c">{!c}</apex:dataList>
                </apex:outputPanel>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputPanel>

 
Hi Team,

We have updated the field in same object using before insert & Update triggers, Is it necessary to use Recursive class for this trigger.

Please let me know.

Thanks,
Lakshmi.
Hi Team,

Requirement : Update the Field A based on Field B value using trigger, Filed B value updated using Work flow. How can we achieve that using trigger (Insert and update events) .

Please let me know.

Thanks,
Lakshmi.
Hi Team,

Please advise below trigger format is correct or not, we are avoiding recursive triggers using static methods in helper class.
trigger testTrigger on Account(before insert, before update, after insert){
        if(Trigger.isInsert){
            if(Trigger.isAfter){
           TriggerHandlerCls.testMethod(Trigger.New);
          }
    }

}

class:
---------
public class TriggerHandlerCls{

public static void testMethod(List<Account> acc){
// logic

}

}
Please let me know.

Thanks,
Lakshmi
 
Hi Team,

AutoRabit is usful for small teams like 1 or 2 developers in salesforce.

Please let me know any one.

Thanks,
Lakshmi.
Hi Team,

I am using setTargetObjectid(userInfo.getUserId()) is used while sending email from Apex code using Single Email Message for template.
I didn;t get email.
Please let me know how can we do that using userid instead of contact.

Thanks
Lakshmi.
Hi Team,

Can we use System.debug(' caught exception'+ex.getMessage()) this statement in catch block (Production).
Please advise is this any issue in production.

Thanks,
Lakshmin.

 
Hi Team,

I am doing upsert(insert + update) operation on opportunity using Dataloader, getting errror like ' Duplicate id specified '. we are not using any external id's, just updating existing records and inserting new records.

Please let me know how can we resolve this...

Thanks,
Lakshmi
Hi Team,

which is the best scenario for calling handler class

Scenario : 1
-------------------
trigger OpportunityTrigger on Opportunity (before insert, before update, before delete, after insert, after update) {
    
    if(Trigger.isBefore && Trigger.isInsert){
        
        // before insert.
        
    }
    
    if(Trigger.isBefore && Trigger.isUpdate){
        
        //  before update.
        
    }
    
    if(Trigger.isBefore && Trigger.isDelete){
        
         //  before delete
    }
    
}
Scenario : 2
trigger OpportunityTrigger on Opportunity (before insert, before update, before delete, after insert, after update) {
    
    if(Trigger.isBefore){
        
        if(Trigger.isInsert){
            
            // before insert
        }
        else
            if(Trigger.isUpdate){
                
                // before update.
                
            }
        
        else
            if(Trigger.isDelete){
                
              //  before delete
                
            } 
    }
        
}

Please let me know which is the best practice.

Thanks,
Lakshmi.

 
Hi Team,

We have a process on opportunity for creating the record in related object based on criteria.
My requirement is after creating the record in opportunity, if the criteria match related object record created using process.We need to redirect the standard detail page from opportunity to related object record detail page.

Please let  me know , how can we do this...

Thanks in advance.
Regards
Lakshmi.
Hi Team,

I want to send an email using before delete trigger (Record details).
Trigger :
trigger DeleteNotify on Custom__c (Before Delete) {
    
    if(Trigger.isBefore && Trigger.isDelete){
        
        for(Custom__c c : Trigger.old){
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
    
    String[] toAddresses = new String[] {'test@gmail.com'};
	mail.setToAddresses(toAddresses); 
    mail.setSenderDisplayName('GWSCRM'); 
    mail.setUseSignature(false); 
    mail.setBccSender(false); 
    mail.setSaveAsActivity(false); 
    
   mail.setTreatTargetObjectAsRecipient(true);
   mail.setTargetObjectId(c.Id);
    //mail.setTreatBodiesAsTemplate(true);
   // mail.setWhatId(c.Id);
    EmailTemplate et=[Select id from EmailTemplate where Name=:'Canadian Project Management Delete Record']; 
    mail.setTemplateId(et.id); 
    
    
    Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

            
        }
    }


    
 
}
Error : Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger DeleteNotify caused an unexpected exception, contact your administrator: DeleteNotify: execution of BeforeDelete caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_TYPE_FOR_OPERATION, Only User, Contact, Lead, or Person objects are allowed for targetObjectId: a0D4F000000PczF.: [targetObjectId, a0D4F000000PczFUAS]: Trigger.DeleteNotify: line 24, column 1". 

Note : Using Email Template (Merge fileds)
Please let me know any one...

Regards,
Lakshmi.

 
Hi Team,

How can we bulkify below trigger.
trigger CreateOpportunity on Task (after insert) {
    
    if(Trigger.isInsert && Trigger.isAfter){
        Set<Id> taskid = new Set<Id>();
        Map<Id, Task> taskmap = new Map<Id, Task>();
        
        List<Opportunity> oppList = new List<Opportunity>();
        Opportunity opp = Null;
        for(Task t : Trigger.New){
            if(t.Sales_Outreach__c == 'Converted to New Opportunity' && t.WhatId == Null){
                System.debug('----'+t.Subject+'---'+t.Id);
                taskid.add(t.Id);
                opp = new Opportunity();
                opp.Name = t.Subject;
                opp.Lead_Country__c = 'India';
                opp.Region__c = 'South';
                opp.CloseDate = Date.newInstance(2018, 10, 20);
                opp.ForecastCategoryName = 'Best Case';
                opp.StageName = 'Intro Meeting / Discovery';
                opp.Category__c = 'Cultivation Targets';
               //oppList.add(opp);
            } 
        }
        
        if(opp != Null){
            
            insert opp;
        }
        
        if(taskid.size() > 0){
            Task t = [Select id from Task where id in :taskid limit 1];
            t.WhatId = opp.Id;
            update t;
        }
    
        
       // t.WhatId = opp.Id;
       // update t;
        
    }

}
Please let me konw any one !!!

Thanks,
Regards.
 
Hi Team,

From Task based on picklist option we are creating new opportunity using process builder, Is it possible to assign that task to Opportunity,

Please Let me know any one.


Thanks,
Lakshmi
Hi Team,

How can we bulkify this using trigger handler class, please let me know any one.
Trigger :
---------------
trigger OpportunityTrig on Opportunity (before insert, before update, after insert, after update) {
    
    
    if(Trigger.isBefore && Trigger.isInsert){
        
  for(opportunity op : Trigger.New){
            //opportunity o = Trigger.oldmap.get(op.Id);
            if(op.Close_Deal_Date__c != null){
                
                
                Integer y = op.Close_Deal_Date__c.YEAR();
                Integer m = ((op.Close_Deal_Date__c.MONTH()-1)/3)+1;
                String q = String.valueOf(y)+' Q'+String.valueOf(m);
                system.debug('y'+y+' Mon :'+m+' Quarter:'+q);
                op.Reporting_Quarter__c = q;
            }
            else if(op.Close_Deal_Date__c == null){
                op.Reporting_Quarter__c = null;
            }
            
            
        }

    }
    
    if(Trigger.isBefore && Trigger.isUpdate){
       OpportunityTriggerHandlerCls.oppCategoryUpdate((List<Opportunity>)Trigger.New);
        for(opportunity op : Trigger.New){
            opportunity o = Trigger.oldmap.get(op.Id);
            if(op.Close_Deal_Date__c != null && (op.Close_Deal_Date__c != o.Close_Deal_Date__c)){
                
                
                Integer y = op.Close_Deal_Date__c.YEAR();
                Integer m = ((op.Close_Deal_Date__c.MONTH()-1)/3)+1;
                String q = String.valueOf(y)+' Q'+String.valueOf(m);
                system.debug('y'+y+' Mon :'+m+' Quarter:'+q);
                op.Reporting_Quarter__c = q;
            }
            else if(op.Close_Deal_Date__c == null && (op.Close_Deal_Date__c != o.Close_Deal_Date__c)){
                op.Reporting_Quarter__c = null;
            }
            
        }
    }
}

I want to bulkify this code using trigger handler class.


Regards,
Lakshmi
 
Hi Team,

How to convert Date to Quarter?
Date : 08/03/2018 this i want to convert like 2018 Q3.
How can we convert this using Trigger.

Note : Not using formula.

Please let me know any one.


Regards
Lakshmi.
Hi Team,

I have generated a report on Opportunity with same filter condition, for this filter i am using below soql query. But Report and developer cosole fetching different records (Records mismatch ).

SOQL Query :
----------------------
Select id,Name from Opportunity WHERE (Category__c = 'Red Zone / Awarded, Negotiating Contract' OR  Category__c = 'Top Pursuits' OR  Category__c ='Cultivation Targets')
 AND (Region__c != 'Portfolio Services' OR Region__c !='KLMK' OR Region__c != 'Competitors ')
 AND Top_10__c = 'Yes'
 AND (Pursuit_Type__c ='New' OR Pursuit_Type__c ='Expansion' OR Pursuit_Type__c ='Renewal' OR Pursuit_Type__c ='Extension')
 AND (NOT Name Like '%Dummy%')
Report Filter  :
------------------------
Filtered By:   Edit 
   	Category equals "Red Zone / Awarded, Negotiating Contract",Top Pursuits,Cultivation Targets Clear 
   	AND Selling Team not equal to Portfolio Services,KLMK,Competitors Clear 
   	AND Growth Report Pursuit equals Yes Clear 
   	AND Pursuit (Type) equals New,Expansion,Renewal,Extension Clear 
   	AND Opportunity Name does not contain Dummy Clear

Please let me know any one......
How can we resolve this issue...

 
Hi Team,

I want to assign the different visualforce pages to different profiles or different record types on Same object.

Please let me know any one...

Thanks
Lakshmi
Hi Team,

How we can do the Report Scheduler SFTP configuration in Salesforce ?
Does Report Scheduler support authentication by public/private keys?
How do we generate the key pair / public key?

Please let me know any one...

Regards,
Lakshmi
Hi Team,

I am creating a button in opportunity record detail page.from here i am redirecting one visualforce page to another visualforce page after clicking button.
It's taking some time for redirecting. How can we resolve this performance issue?
(Requirement : Open child object record edit page with pre-populated values from Opportunity using button. For i have created two vf pages and controllers. From first page i have redirect to second page with opportunity record id, here i am using child object standard controller).
Note : I tried using URL hacking, but it is not working in Lightning. After that i did this using VF pages. Please let me know any alternative solutions.

Thanks,
Lakshmi.

Please let me know how to resolve this issue ?
 
Hi Team,
How to redirect the visualforce page to record detail page after clicking on Cancel Button ?

Controller Class
-------------------------
public with sharing class ControllerClass {
    
    public static String oppid;
    
    private ApexPages.StandardController sc{get;set;}
    public Opportunity opp = new Opportunity();
    public ControllerClass(ApexPages.StandardController sc){
        this.sc = sc;
        oppid = ApexPages.currentPage().getParameters().get('oppid');
        //system.debug('------'+oppid);
        opp =[select id,name,Account.name from Opportunity where id =:oppid limit 1];
 
    }
    }
    
    Public PageReference Cancel(){
        PageReference pr = new PageReference('/'+Schema.SObjectType.Opportunity.getKeyPrefix()+'/o');
        return pr;
        }

}
How to redirect this page to opportunity record detail page.
Please let me know any one.

Regrds
Lakshmi
 
Hi Team,

How to write test class for below code.
Controller
-----------------
public with sharing class TPipelineControllerClass {
    
    public static String oppid;
    
    public X360_Pipeline__c pipeline{get;set;}
    private ApexPages.StandardController sc{get;set;}
    public Opportunity opp = new Opportunity();
    public TPipelineControllerClass(ApexPages.StandardController sc){
        this.sc = sc;
        oppid = ApexPages.currentPage().getParameters().get('oppid');
        //system.debug('------'+oppid);
        opp =[select id,name,Account.name from Opportunity where id =:oppid limit 1];
        //system.debug('---'+hr.Name);
        //system.debug('---'+hr.Account.Name);
        pipeline = new X360_Pipeline__c();
        pipeline.Name = opp.Name;
        //system.debug('-------pipeline.Name'+pipeline.Name);
        pipeline.Account_Name__c= opp.AccountId;
        pipeline.Opportunity_Name__c = opp.Id;
    }
    
    public PageReference save(){
        try{
            insert pipeline;
            return new PageReference('/'+pipeline.Id);
        }catch(Exception ex){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));
            return null;
        }
        
        
    }
    
    Public PageReference Cancel(){
        PageReference pr = new PageReference('/'+Schema.SObjectType.Opportunity.getKeyPrefix()+'/o');
        return pr;
        }

}
Test Class :
----------------
@isTest
public class TestTPipelineControllerClass {
    
    @isTest
    private static void test360Pipeline(){
        Test.startTest();
        
        PageReference pr = Page.TPipelineVFPage;
        Test.setCurrentPage(pr);
        
        Opportunity op = new Opportunity();
        try{
            Account acc = new Account(Name='Dummy Account');
            	insert acc;
        	
                op.Name = 'Dummy Oppty';
                op.AccountId = acc.Id;
                op.Lead_Country__c = 'India';
                op.Region__c = 'APAC';
                op.CloseDate = Date.newInstance(2018, 02, 20);
                op.ForecastCategoryName = 'Best Case';
                op.StageName = 'Red Zone / Awarded';
                op.Probability = 90;
                op.Category__c = 'Red Zone / Awarded, Negotiating Contract';
            insert op;
            X360_Pipeline__c pipe = new X360_Pipeline__c();
            pipe.Name = op.Name;
            pipe.Opportunity_Name__c = op.Id;
            pipe.Account_Name__c = op.AccountId;
            insert pipe;  
            
            pr.getParameters().put('id',pipe.Id);
        
            ApexPages.StandardController sc = new ApexPages.StandardController(pipe);
            TPipelineControllerClass pipeline = new TPipelineControllerClass(sc);
            
            pipeline.save();
            pipeline.Cancel();
        
        }
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
        }
        
        System.assert(true);
        System.assertNotEquals(Null, op.id);
        
        Test.stopTest();
    }

}
Can any one please help me how to write test class.

Thanks
Lakshmi

 
Hi Team,

AutoRabit is usful for small teams like 1 or 2 developers in salesforce.

Please let me know any one.

Thanks,
Lakshmi.
Hi All,

Q). One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount related stuff.
   Write a trigger that should calculate the sum of 3 tasks.  And if any task is modified than trigger should fire automatically & perform the same.


Can any one reply for this post..
Thanks in advance
 
Hi All,

Q). what is the difference between actionFunction and actionSupport, Explain with funcionality?

can anyone reply for this post...
Thanks in advance..
Hi All,

Q). 3 users with same profile (R/W permissions), need to remove Read permission for one user, how can we achieve that?

Can anyone reply for this post...
Thanks in advance.
Hi All,

Q). What is a future method ? When we are going to use Future methods? Example program for Future method and Schedulable class for Future method?

Give me reply anyone.....
HI All,

Q). What is a Batch Apex,Queueable Apex and @Future methods?, What are the differences between them and when we are going to use these classes?
Can anyone explain these classes.......
 
Hi Team,

We have updated the field in same object using before insert & Update triggers, Is it necessary to use Recursive class for this trigger.

Please let me know.

Thanks,
Lakshmi.
Hi Team,

Requirement : Update the Field A based on Field B value using trigger, Filed B value updated using Work flow. How can we achieve that using trigger (Insert and update events) .

Please let me know.

Thanks,
Lakshmi.
Hi Team,

Please advise below trigger format is correct or not, we are avoiding recursive triggers using static methods in helper class.
trigger testTrigger on Account(before insert, before update, after insert){
        if(Trigger.isInsert){
            if(Trigger.isAfter){
           TriggerHandlerCls.testMethod(Trigger.New);
          }
    }

}

class:
---------
public class TriggerHandlerCls{

public static void testMethod(List<Account> acc){
// logic

}

}
Please let me know.

Thanks,
Lakshmi
 
Hi Team,

I am using setTargetObjectid(userInfo.getUserId()) is used while sending email from Apex code using Single Email Message for template.
I didn;t get email.
Please let me know how can we do that using userid instead of contact.

Thanks
Lakshmi.
Hi Team,

Can we use System.debug(' caught exception'+ex.getMessage()) this statement in catch block (Production).
Please advise is this any issue in production.

Thanks,
Lakshmin.

 
Hi Team,

We have a process on opportunity for creating the record in related object based on criteria.
My requirement is after creating the record in opportunity, if the criteria match related object record created using process.We need to redirect the standard detail page from opportunity to related object record detail page.

Please let  me know , how can we do this...

Thanks in advance.
Regards
Lakshmi.
Hi Team,

I want to send an email using before delete trigger (Record details).
Trigger :
trigger DeleteNotify on Custom__c (Before Delete) {
    
    if(Trigger.isBefore && Trigger.isDelete){
        
        for(Custom__c c : Trigger.old){
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
    
    String[] toAddresses = new String[] {'test@gmail.com'};
	mail.setToAddresses(toAddresses); 
    mail.setSenderDisplayName('GWSCRM'); 
    mail.setUseSignature(false); 
    mail.setBccSender(false); 
    mail.setSaveAsActivity(false); 
    
   mail.setTreatTargetObjectAsRecipient(true);
   mail.setTargetObjectId(c.Id);
    //mail.setTreatBodiesAsTemplate(true);
   // mail.setWhatId(c.Id);
    EmailTemplate et=[Select id from EmailTemplate where Name=:'Canadian Project Management Delete Record']; 
    mail.setTemplateId(et.id); 
    
    
    Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

            
        }
    }


    
 
}
Error : Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger DeleteNotify caused an unexpected exception, contact your administrator: DeleteNotify: execution of BeforeDelete caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_TYPE_FOR_OPERATION, Only User, Contact, Lead, or Person objects are allowed for targetObjectId: a0D4F000000PczF.: [targetObjectId, a0D4F000000PczFUAS]: Trigger.DeleteNotify: line 24, column 1". 

Note : Using Email Template (Merge fileds)
Please let me know any one...

Regards,
Lakshmi.

 
Hi Team,

From Task based on picklist option we are creating new opportunity using process builder, Is it possible to assign that task to Opportunity,

Please Let me know any one.


Thanks,
Lakshmi
Hi Team,

I have generated a report on Opportunity with same filter condition, for this filter i am using below soql query. But Report and developer cosole fetching different records (Records mismatch ).

SOQL Query :
----------------------
Select id,Name from Opportunity WHERE (Category__c = 'Red Zone / Awarded, Negotiating Contract' OR  Category__c = 'Top Pursuits' OR  Category__c ='Cultivation Targets')
 AND (Region__c != 'Portfolio Services' OR Region__c !='KLMK' OR Region__c != 'Competitors ')
 AND Top_10__c = 'Yes'
 AND (Pursuit_Type__c ='New' OR Pursuit_Type__c ='Expansion' OR Pursuit_Type__c ='Renewal' OR Pursuit_Type__c ='Extension')
 AND (NOT Name Like '%Dummy%')
Report Filter  :
------------------------
Filtered By:   Edit 
   	Category equals "Red Zone / Awarded, Negotiating Contract",Top Pursuits,Cultivation Targets Clear 
   	AND Selling Team not equal to Portfolio Services,KLMK,Competitors Clear 
   	AND Growth Report Pursuit equals Yes Clear 
   	AND Pursuit (Type) equals New,Expansion,Renewal,Extension Clear 
   	AND Opportunity Name does not contain Dummy Clear

Please let me know any one......
How can we resolve this issue...

 
Hi Team,
How to redirect the visualforce page to record detail page after clicking on Cancel Button ?

Controller Class
-------------------------
public with sharing class ControllerClass {
    
    public static String oppid;
    
    private ApexPages.StandardController sc{get;set;}
    public Opportunity opp = new Opportunity();
    public ControllerClass(ApexPages.StandardController sc){
        this.sc = sc;
        oppid = ApexPages.currentPage().getParameters().get('oppid');
        //system.debug('------'+oppid);
        opp =[select id,name,Account.name from Opportunity where id =:oppid limit 1];
 
    }
    }
    
    Public PageReference Cancel(){
        PageReference pr = new PageReference('/'+Schema.SObjectType.Opportunity.getKeyPrefix()+'/o');
        return pr;
        }

}
How to redirect this page to opportunity record detail page.
Please let me know any one.

Regrds
Lakshmi