• pcmca_2007@yahoo.co.in
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 12
    Replies

Hi All,

          I have a requirement that the selected checkboxes from checkboxlist will become unchecked after command

          button is pressed.Can anybody will guide me how I should achieve this.

 

      With Regards

       Prabhash Mishra

Hi All,

          I am newer to SalesForce.I have to write test class for the following test class.Its urgent please guide me.

 

 

CLASS:

 

global class Reminder_for_DeligatedApprover implements Schedulable
{
    global void execute(SchedulableContext ctx)
    {
        try
        {
            Map<id,string> Map_User_manager = new Map<id,string>();
            List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>(); 
            for(User Obj_Manager : [select id, name, email from user where profile.name in('District Client Manager','MSA GCG Client Manager','National Client Manager','Regional Client Manager') and isactive = false])
            {
                Map_User_manager.put(Obj_Manager.id,Obj_Manager.email);
            }
            datetime dt = system.now();
            dt = dt.addDays(-9);
            for(user obj_user : [select id, name, email,DelegatedApproverId,CreatedDate from user where (DelegatedApproverId =: '' or DelegatedApproverId =: null) and isactive = true and createddate <= :dt])
            {
                if(Map_User_manager.containsKey(obj_user.id))
                {
                    String[] toAddresses = new String[] {Obj_User.email};                  
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    mail.setToAddresses(toAddresses);
                    mail.setSubject('Please set Delegated Approver');
                    mail.setPlainTextBody('Please set Delegated Approver.');                  
                    mailList.add(mail);
                }
            }
            if(mailList.size() > 0)
            {
                Messaging.SendEmailResult[] result = Messaging.sendEmail(mailList);
            }
        }
        catch(Exception e)
        {
            system.debug('Exception occured in Reminder_for_DeligatedApprover(): '+ e);
            throw e;
        }
    }
}

 

With Regards

Prashant

Hi,

     How do i check that a particular User is manager or not.

 

  With Regards

Prabhash Mishra

Hi All,

          I have to write a trigger on user where i have to check if user is manager and if he does not update its

          delegatedapprover for 10 days from its date of creation then a mail should sent to him.Can anubody tell

           me how i should do this.

 

          With Regards

          Prabhash mishra

Hi All,

          I have to write a validation rule on when a user is created with first Name as Open TMID , Delegated approver should 

          be same as Manager.But how should i get  Delegated approver and Manager.Can anybody help me out.

 

  With Regards

  Prabhash Mishra

Hi,

    I am trying to insert product on opportunity using dataLoader but Out of 279 records we were able to insert 179 records. 100 records throw the exception.The error i get is as:

 

          updateOpportunity: execution of AfterInsert

caused by: System.DmlException: Update failed. First exception on row 0 with id 006S00000058CnhIAE; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [StageName]: [StageName]

Class.Update_OpportunityStageAndStatus_Class.updateOpenStatus_2: line 196, column 14
Trigger.updateOpportunity: line 60, column 10

 

Can any one suggest me what could be the reason for that.

 

With Regards

Prabhash Mishra

Hi all,

           I am getting error on product insertion on Opportunity.apex class Update_OpportunityStageAndStatus_Class in which if you see line number 186,187 you will find getStage(lowest) having null value.The class file is too long,so

 i am sending it in two post.So please combine these two section into one and solve my problem

 

FIRST SECTION:

 

public with sharing class Update_OpportunityStageAndStatus_Class {

public static void updateOpenStatus(Map<Id, OpportunityLineItem> opplineitemMap)
  {
    System.debug('inside method');
    List <Opportunity> oppList = [Select id, StageName, INTL_Status__c from Opportunity where Id in :opplineitemMap.keySet()];
    System.debug('inside method' +oppList);
    if(oppList != null && oppList.size()>0)
    {
      for(Opportunity opp : oppList)
      {

        opp.INTL_Status__c = 'Open';
      }

      update oppList;
      System.debug('Opportunity are updated for status as open');
    }
  }

  private static integer assignWeight(String Stage)
  {
    Integer retString =0;
    if(Stage.contains('0') )
        retString =0;
    if(Stage.contains('1') )
        retString =1;
    if(Stage.contains('2') )
        retString =2;
    if(Stage.contains('3') )
        retString =3;
    if(Stage.contains('4') )
        retString =4;
    if(Stage.contains('5') )
        retString =5;
    if(Stage.contains('6') )
        retString =6;
    if(Stage.contains('7') )
        retString =7;
    if(Stage.contains('8') )
        retString =8;
    if(Stage.contains('9') )
        retString =9;
    return  retString;

  }

    private static String getStage(integer Weight)
    {
      String retString ='';

    if(Weight== 0)
          retString ='0. Identify';
    if(Weight== 1)
          retString ='1. Qualify';
    if(Weight== 2)
          retString ='2. First Contact';
    if(Weight== 3)
          retString ='3. Assess Needs';
    if(Weight== 4)
          retString ='4. Formal Offer';
    if(Weight== 5)
          retString ='5. Verbal Win';
    if(Weight== 6)
          retString ='6. Complete';
    if(Weight== 7 || Weight== 8 || Weight== 9 )
          retString ='6. Complete';
      return  retString;

      }

  public static void updateOpenStatus_2(List<OpportunityLineItem> opplineitemList , List<Opportunity> oppList,Map<ID, Opportunity> oppMap)
  {
        List<Opportunity> LastUpdateOppList = new List<Opportunity>();
        List<OpportunityLineItem> LineItembyOpp = new List<OpportunityLineItem>();
        List<Opportunity> updateOppList = new List<Opportunity>();
        Map<ID , List<OpportunityLineItem>> MapOppandLineItem = new  Map<ID , List<OpportunityLineItem>>();
        System.debug('inside method');

            for(Opportunity opp : oppList)
            {
                 List<OpportunityLineItem> tempList = new List<OpportunityLineItem>();

                 for(OpportunityLineItem oppListitem2 : opplineitemList)
                 {
                    if(oppListitem2.OpportunityId == opp.ID)
                    {
                        tempList.add(oppListitem2);
                    }
                 }
            //This map contains opportunity and list of opportunity line items under it
             MapOppandLineItem.put(opp.ID , tempList);
             system.debug('Map' +MapOppandLineItem);
            }

             for(ID oppID :  MapOppandLineItem.keySet())
             {  system.debug('inside for1');
                Opportunity opptoUpdate=oppMap.get(oppID);
                opptoUpdate.Flag__c = true;
                String oppStage=opptoUpdate.StageName;
               
                Integer lineItemSize = MapOppandLineItem.get(oppID).size();
                Integer RejectCount = 0;
                Integer lineItemCount = 0;
                Integer oppStageWt = assignWeight(oppStage);
                Boolean lineItemOpen = false;
                Boolean lineItemSigned = false;
                Boolean lineitemrejected = false;
                system.debug('opptoUpdatebeforeupdate' +oppStage);
                system.debug('stagein opp' +oppStageWt);
                String lineItemSatge = MapOppandLineItem.get(oppID)[0].stage__c;
                integer lowest = assignWeight(lineItemSatge);
                system.debug('loweststagebeforeiteration' + lowest);
                for(OpportunityLineItem oppLineItem : MapOppandLineItem.get(oppID))
                {   system.debug('inside for2');
                    Integer lineItemWt = assignWeight(oppLineItem.Stage__c);
                    system.debug('stagein opplineitem' +lineItemWt);
                    //if(oppLineItem.Status__c!='Rejected')
                      // {


         With Regards

Prabhash Mishra

Hi All,

         Can we convert an existing picklist type into Lookup type ?If yes than how we can do that.Can anybody give me

         detailes process.

 

      With Regards

       Prabhash Mishra

Hi All,

          I have created a visualforce templet and I want to send the content using this templet.Can anybody provide me

          code for Message class for sending mail with VF templet.

 

   with Regards

Prabhash mishra

Hi All,

          I created a field EAQ_Email_Flag__c as flag which default value is false.But after sending the mail i want to update it

          true.My approach is like that

 

          List <Opportunity> opptyList = new List<Opportunity>();

         for(Opportunity oppnew:Trigger.new){

 

            opptyList.add(opptyList);

         }

But after Sending mail when I write

           opptyList.EAQ_Email_Flag__c=true;
                   update opptyList;

 

Error it shows:-Variable does not exist: EmaiStatusChange at line 127 column 66

 

Can anybody help me ou in solving this problem.I am sending single email to Owner.

 

With Regards

Prabhash Mishra

Hi All,

          I need to write trigger on opportunity on stage change and send a mail to owner of that opportunity.

          Can anybody tell me what  trigger should look like.

 

    With Regards

   Prabhash Mishra

Hi All,

           what is standard opportunities.How email alert can send to new opportunity as well as historical opportunity

            using the batch apex.Please clear the concept.

 

   With Regards

    Prabhash mishra

Hi All,

          Can anybody tell me how bulkmail could be send with the batch apex.I want to send mail to all the opportunity

          whose StageName changes from one stage to some other stage.Can anybody suggest me the solution.

 

  With Regards

  Prabhash Mishra

Hi All,

          I want to write batch apex to send email alert on opportuniry.Can anybody give me any idea how to write batch

          apex for sending email alert.Please give me some standared code so that i could add/modyfi according to my need.

 

 

   With Regards

   Prabhash mishra

Hi All,

          Can you explain me in which below mentioned scenario extension controller is used:

         

          1) StandaredController with ExtensioController

           2)Controller and Extensioncontroller

 

          Can you also tell me the difference in both Regarding Workflow:

 

          a)When a record is created, or when a record is edited and did not previously meet the rule criteria

          b)Every time a record is created or edited

 

    With Regards

    Prabhash Mishra

Hi All,

          I want to know why RecordTypes are used in salesforce.It is used  to control picklist value what it means.If there

          is any other use of RecordType than explain me.I want to know concept of RecordType.

 

     With Regards

     Prabhash Mishra

Hi All,

          Please tell me relation in AccountOwner,OpportunityOwner and ContactOwner.They are person or company itself.

          How it is related to accountName,OpportunityName and ContactName.

 

         Thanks & Regards

          Prabhash Mishra

Hi All,

           This is my first assignment.Plsease help me out.I have to send an email alert for completing questionnaire.But this

           alert will include on email a link to blue print where questionnaire format will be available.Please tell me the steps

            i should take.

 

     With Regards

     Prabhash Mishra

Hi All,

           Can anybody tell me what is the difference in using Trigger.new with Before Insert and After Insert.In which condition

           Trigger.new used either with Before Insert or After Insert.Is any difference in the state of data during these two event?

 

 

        With Regards

        Prabhash Mishra

Hi All,

           Can anybody explain in detail about render and rerender in visualforce.Also in what scenario both can be used.

            Just help me in clearing the concept of both as i am newer to salesforce.

 

     With Regards

      prabhash Mishra

Hi All,

          I have to write a validation rule on when a user is created with first Name as Open TMID , Delegated approver should 

          be same as Manager.But how should i get  Delegated approver and Manager.Can anybody help me out.

 

  With Regards

  Prabhash Mishra

Hi,

    I am trying to insert product on opportunity using dataLoader but Out of 279 records we were able to insert 179 records. 100 records throw the exception.The error i get is as:

 

          updateOpportunity: execution of AfterInsert

caused by: System.DmlException: Update failed. First exception on row 0 with id 006S00000058CnhIAE; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [StageName]: [StageName]

Class.Update_OpportunityStageAndStatus_Class.updateOpenStatus_2: line 196, column 14
Trigger.updateOpportunity: line 60, column 10

 

Can any one suggest me what could be the reason for that.

 

With Regards

Prabhash Mishra

Hi all,

           I am getting error on product insertion on Opportunity.apex class Update_OpportunityStageAndStatus_Class in which if you see line number 186,187 you will find getStage(lowest) having null value.The class file is too long,so

 i am sending it in two post.So please combine these two section into one and solve my problem

 

FIRST SECTION:

 

public with sharing class Update_OpportunityStageAndStatus_Class {

public static void updateOpenStatus(Map<Id, OpportunityLineItem> opplineitemMap)
  {
    System.debug('inside method');
    List <Opportunity> oppList = [Select id, StageName, INTL_Status__c from Opportunity where Id in :opplineitemMap.keySet()];
    System.debug('inside method' +oppList);
    if(oppList != null && oppList.size()>0)
    {
      for(Opportunity opp : oppList)
      {

        opp.INTL_Status__c = 'Open';
      }

      update oppList;
      System.debug('Opportunity are updated for status as open');
    }
  }

  private static integer assignWeight(String Stage)
  {
    Integer retString =0;
    if(Stage.contains('0') )
        retString =0;
    if(Stage.contains('1') )
        retString =1;
    if(Stage.contains('2') )
        retString =2;
    if(Stage.contains('3') )
        retString =3;
    if(Stage.contains('4') )
        retString =4;
    if(Stage.contains('5') )
        retString =5;
    if(Stage.contains('6') )
        retString =6;
    if(Stage.contains('7') )
        retString =7;
    if(Stage.contains('8') )
        retString =8;
    if(Stage.contains('9') )
        retString =9;
    return  retString;

  }

    private static String getStage(integer Weight)
    {
      String retString ='';

    if(Weight== 0)
          retString ='0. Identify';
    if(Weight== 1)
          retString ='1. Qualify';
    if(Weight== 2)
          retString ='2. First Contact';
    if(Weight== 3)
          retString ='3. Assess Needs';
    if(Weight== 4)
          retString ='4. Formal Offer';
    if(Weight== 5)
          retString ='5. Verbal Win';
    if(Weight== 6)
          retString ='6. Complete';
    if(Weight== 7 || Weight== 8 || Weight== 9 )
          retString ='6. Complete';
      return  retString;

      }

  public static void updateOpenStatus_2(List<OpportunityLineItem> opplineitemList , List<Opportunity> oppList,Map<ID, Opportunity> oppMap)
  {
        List<Opportunity> LastUpdateOppList = new List<Opportunity>();
        List<OpportunityLineItem> LineItembyOpp = new List<OpportunityLineItem>();
        List<Opportunity> updateOppList = new List<Opportunity>();
        Map<ID , List<OpportunityLineItem>> MapOppandLineItem = new  Map<ID , List<OpportunityLineItem>>();
        System.debug('inside method');

            for(Opportunity opp : oppList)
            {
                 List<OpportunityLineItem> tempList = new List<OpportunityLineItem>();

                 for(OpportunityLineItem oppListitem2 : opplineitemList)
                 {
                    if(oppListitem2.OpportunityId == opp.ID)
                    {
                        tempList.add(oppListitem2);
                    }
                 }
            //This map contains opportunity and list of opportunity line items under it
             MapOppandLineItem.put(opp.ID , tempList);
             system.debug('Map' +MapOppandLineItem);
            }

             for(ID oppID :  MapOppandLineItem.keySet())
             {  system.debug('inside for1');
                Opportunity opptoUpdate=oppMap.get(oppID);
                opptoUpdate.Flag__c = true;
                String oppStage=opptoUpdate.StageName;
               
                Integer lineItemSize = MapOppandLineItem.get(oppID).size();
                Integer RejectCount = 0;
                Integer lineItemCount = 0;
                Integer oppStageWt = assignWeight(oppStage);
                Boolean lineItemOpen = false;
                Boolean lineItemSigned = false;
                Boolean lineitemrejected = false;
                system.debug('opptoUpdatebeforeupdate' +oppStage);
                system.debug('stagein opp' +oppStageWt);
                String lineItemSatge = MapOppandLineItem.get(oppID)[0].stage__c;
                integer lowest = assignWeight(lineItemSatge);
                system.debug('loweststagebeforeiteration' + lowest);
                for(OpportunityLineItem oppLineItem : MapOppandLineItem.get(oppID))
                {   system.debug('inside for2');
                    Integer lineItemWt = assignWeight(oppLineItem.Stage__c);
                    system.debug('stagein opplineitem' +lineItemWt);
                    //if(oppLineItem.Status__c!='Rejected')
                      // {


         With Regards

Prabhash Mishra

Hi All,

          I created a field EAQ_Email_Flag__c as flag which default value is false.But after sending the mail i want to update it

          true.My approach is like that

 

          List <Opportunity> opptyList = new List<Opportunity>();

         for(Opportunity oppnew:Trigger.new){

 

            opptyList.add(opptyList);

         }

But after Sending mail when I write

           opptyList.EAQ_Email_Flag__c=true;
                   update opptyList;

 

Error it shows:-Variable does not exist: EmaiStatusChange at line 127 column 66

 

Can anybody help me ou in solving this problem.I am sending single email to Owner.

 

With Regards

Prabhash Mishra

Hi All,

           This is my first assignment.Plsease help me out.I have to send an email alert for completing questionnaire.But this

           alert will include on email a link to blue print where questionnaire format will be available.Please tell me the steps

            i should take.

 

     With Regards

     Prabhash Mishra

Hi All,

          I have created a lead and tried to convert it into opportunity.I have a trigger on opportunity that throws an error

          "Attempt to de-reference a null object".I want to know why it is throwing error and is "Attempt to de-reference a null  object" and "Null pointer exception of java is same.I have java backgrount and just started working on salesforce.

 

Code for my Trigger is as below:

 

 

    trigger CompOldNew on Opportunity (before insert,before update) {
    Map<Id,String> oppIDs=new Map<Id,String>();
   
    for(Opportunity opp : Trigger.new){
                    //Create an old and new map so that we can compare values
                                   
                     Opportunity oldOpp= Trigger.oldMap.get(opp.ID);
                     Opportunity newOpp = Trigger.newMap.get(opp.ID);
            System.debug('oldOppoldOpp&&&&&&'+oldOpp+'newOppnewOpp$$$$$'+newOpp);
                    //Retrieve the old and new Reseller Email Field           
                    string oldResellerEmail = oldOpp.Reseller_Email__c;
                    string newResellerEmail = newOpp.Reseller_Email__c;
   System.debug('oldResellerEmail==='+oldResellerEmail+'newResellerEmail==='+newResellerEmail);           
                    //If the fields are different, the email has changed
                    if(oldResellerEmail != newResellerEmail){
                        oppIDs.put(opp.Id,opp.Reseller_Email__c);
                          
                    }
                    System.debug('MAP VALUE======'+oppIDs);
                   
}

List<Opportunity> ls=new List<Opportunity>([select name,Reseller_Email__c from Opportunity where id in :Trigger.oldMap.keySet()]);
System.debug('XXXXXXXXXXXXXXXXXXXXXX'+ls);


}

 

 

With Regards

Prabhash Mishra

 

Hi All,

          Can anybody tell me about detailed process of how a lead convert into account,contact and opportunity.I want to

           know in detail about opportunity because it seems to critical.I am new to salesforce,so please convey me relation

           in lead,account,contact and opportunity(Opportunity in particular).

 

    With Regards

    Prabhash Mishra



Hello,

 

I am doing email to apex.In this regard, i need to get the Id of contact that is inserted and then use that Id to create a Task.

For some reason i am unable to do it.

There is another post which says to get the Inserted record Id as "Object.Id". but i am unable to do it.

 

Here is my Code:

 

global class ProcessApplicants implements
Messaging.InboundEmailHandler
{

    contact[] mycontact=new contact[0];
    
    global Messaging.InboundEmailResult handleInboundEmail
    (Messaging.InboundEmail email,Messaging.InboundEnvelope env)
    {
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
        string emailaddress=env.fromaddress;
        string[] emailbody=email.plainTextBody.split('\n',0);
        string fname=emailbody[0];
        string lname=emailbody[0];
        try
        {
            mycontact.add(new contact(FirstName=fname,LastName=lname));
            insert mycontact;         
            
        }
        catch(system.DMLexception e)
        {
           System.debug('Error:Not able to create Contact:'+e); 
        }
       
       
        Task myTask=new Task();
        myTask.Subject='Make a Call';
        myTask.Description='For Testing Purpose';
        myTask.Priority='Normal';
        //myTask.WhatId=c_Id.Id;
        
        
            
        
return result;
}

Can any one help me here. I need to get the inserted contact Id then use that contact Id to assign a task.

 

Thanks in advance!

Sales4ce