• rohitsfdc
  • SMARTIE
  • 923 Points
  • Member since 2010
  • Salesforce Freenlancer
  • Applikon IT Solutions


  • Chatter
    Feed
  • 34
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 246
    Replies

I m using the following Eclipse version as IDE from force.com project

Eclipse Standard/SDK
Version: Kepler Release
Build id: 20130614-0229

But it is not showning intellisense for objects, not even for the standard objects.. it just diaplay "no proposals"
here is the snapshot for the same
no intellisense

but when I save the code...it connects to the ORG and updates the code in the org if everything is correct else it throw the error..
but there is no intellisense.

Please guide for the setting that are required for this.

Thanks in advance
Sunny

Hi,

I have a time dependent workflow action on a Opportunity to send an email alert 30 days before opportunity close date, if the opportunity amount is greater than 90,000. The email notification is being sent even if the close date of the opportunity is this week. Has any one come across this issue?
Hi

Iam attempting to reduce the number of SOQL's being triggered to avoid the limits.

I currently have two queiries. The first brings back the mailout items and the second brings back the attachements for the mailout items

Get the mailout items
objMailout = [SELECT Id, contact__c, contact__r.Name, recipient_first_name__c, recipient_last_name__c, caps__r.AccountID__c, file_password__c, email_address__c FROM ci_mailout__c WHERE Sent__c = FALSE AND Mailout_name__c = :strTemplate_Initial ORDER BY Policy_count__C Desc LIMIT 50];
Get the attachments for the above mailout items
objAttachment = [SELECT ID, Name, ContentType, body FROM attachment WHERE ParentId = :thisMailOut.Id];
So ... the above works but gets close to the limit for SOQL

So when I try to join the SOQL into 1 I get the following error
A driving SObject type has already been set, all other entity types in the FROM clause must be relationships to the initial object.  The driving object is CI_Mailout__c.
This is the query that I am attempting to use
objMailout = [SELECT Id, contact__c, contact__r.Name, recipient_first_name__c, recipient_last_name__c, caps__r.AccountID__c, file_password__c, email_address__c FROM ci_mailout__c, attachment WHERE ID = :[SELECT PARENTID FROM ATTACHMENT] AND Sent__c = FALSE AND Mailout_name__c = :strTemplate_Initial ORDER BY Policy_count__C Desc LIMIT 50];

Any guidance would be greatly appreciated.

Thanks


 
I have a requirement that the user will select some objects from a list of objects(on a vf page) he has on his org  and i want to fire same trigger on those selected objects individually. Is it possible??
Does anyone have a solution for this?
Hi all,

I have 2 objects: Claim__c and intake__c
Whenever a new claim is created i need to map all values of claim to intake.All values are getting mapped except the recordtype.Can anyone please tell me how to map recordtype from claim to intake 
Hi,

I have a picklist(Multiselect) field, userPkList, that contains a list users in the format of "LastName, FirstName". Each value that is select is separated by a semicolon and the very last entry does not contain a semicolon. 

Example (LastName, FirstName) 1:
 "Schmo, Joe; Allen, Bary; Queen, Oliver"

Example (LastName, FirstName) 2:
"Queen, Oliver, Allen, Bary; Schmo, Joe; Last1, First1; LastAbc, FirstAbc"

I need help in figuring out a way to parse this picklist (multiselect) field so that I can pull each individual Last and First name and then run a query to get the user record associated to that user. I cannot figure out a good way to do this.

Example of desired logic:

//get userPkList values into a string
//parse string so i can separate all the values based on the semicolon (;) so that i now have a list<string> that is in the format of "lastName, FirstName" per record in the list<string>
//for every string in the list<string> I am going to split the string to get first and last name
//then insert first + ' ' + last into a separate List<String>
//using the new List<String>, obtain all the users in the systems.
 
Greetings all, I am running into the Too Many SOQL queries issue when running a test for this apex class. The testregistrations component passes but the mypage_test fails.

Any thing, I may need to adjust here.
 
public class eventsControllerTests {

static testMethod void myPage_Test()
  {
  //Test converage for the myPage visualforce page
  PageReference pageRef = Page.Events_Home;
  Test.setCurrentPageReference(pageRef);
  // create an instance of the controller
  eventsController myPageCon = new eventsController();
  //try calling methods/properties of the controller in all possible scenarios to get the best coverage.

  myPageCon.Setup();
  String efSetupPage = myPageCon.Setup().getUrl();
  System.assertEquals('/apex/EventsSuccess',efSetupPage);

  myPageCon.closePopupOK();

  }
  
    static testMethod void testRegistrationsTrigger(){
        
        //First, prepare 200 contacts for the test data
        
        String contactLastName = 'Apex';
        String contactFirstName = 'Joe';
        String contactTitle = 'Manager';
        Contact ct = new Contact(lastname=contactLastName, firstname=contactFirstName, title=contactTitle);
        insert ct;
        
        ct = [SELECT Name, Title from Contact WHERE Id = :ct.Id];
        
        Event__c ev = new Event__c(name = 'My Event');
        insert ev;

        Event_Registration__c reg = new Event_Registration__c(Contact__c=ct.Id,Event__c=ev.Id);
        insert reg;

        reg = [SELECT Name_on_Badge__c, Title_On_Badge__c from Event_Registration__c WHERE Id = :reg.Id];
        System.assertEquals(ct.Name, reg.Name_on_Badge__c);
        System.assertEquals(ct.Title, reg.Title_on_Badge__c);

           
    }   
}

 
There is a picklist field on a VF page, after clicking on new button once I select a picklist value in the field, how do I fetch the value, before it is saved in the database. I need to use this fetched value to populate another field before the record is saved.
Hi ,

I want to convert Lead to opportunity , recordtype should be assign   based on Lead recordtype.
i have two record types for lead and Opportunity, Based on Lead record type i want to convert Lead to opportunity of  Same name of record typt.

can any one help me out for this......


Regards,
sarevsh.
Hi,

Can someone help as i am pretty new to all this...

I want to write a trigger on the task which updates the task status to completed after the oipportunity is set to Closed Won or Closed lost.

This is to basically prevent any closed opportunities which still have open tasks.

Its an if statement of some sort but I need to learn how to do all this



Thanks in Advanced.

Nick

Hi all,

I am having difficulty creating a test class for a trigger I have created. The trigger updates a date/time field every fime a checkbox field is modified. I am unsure how i would create the tesst trigger, any help would be great.

My trigger is:
trigger ControlRoomCheckedTimeTrigger on Match_Day_Check_List__c (before insert, before update) {
    if(Trigger.isInsert){
     for(match_day_check_list__c b: trigger.new){
      b.Steward_Phone_Check_Complete_Last_Mod__c = DateTime.Now();
      b.Radio_Check_Complete_Last_Modified__c = DateTime.Now();
      b.CCTV_Cameras_Checked_Last_Modified__c = DateTime.Now();
    }
  }
  if(Trigger.isUpdate){
        for(match_day_check_list__c b: trigger.new){
            match_day_check_list__c oldb = Trigger.oldMap.get(b.ID);
            
            if(oldb.Steward_Phone_Check_Complete__c != b.Steward_Phone_Check_Complete__c){
                b.Steward_Phone_Check_Complete_Last_Mod__c = DateTime.Now();
            }
            
            if(oldb.Radio_Check_Complete__c != b.Radio_Check_Complete__c){
                b.Radio_Check_Complete_Last_Modified__c = DateTime.Now();
            }
            
            if(oldb.CCTV_Cameras_Checked__c != b.CCTV_Cameras_Checked__c){
                b.CCTV_Cameras_Checked_Last_Modified__c = DateTime.Now();
            }
            
            if(oldb.Turnstile_Checks_Control_Room__c != b.Turnstile_Checks_Control_Room__c){
                b.Turnstile_Checks_Last_Modified_CRoom__c = DateTime.Now();
            }
            
    }
    
}
}

Many thanks.

We have code created by consultant that allows us to have a product record type of Package.  When a user selects a package from the product list.  They can then unbundle it on the opportunity.  When they do this, it removes the package, inserts the individual products, and adds the configuration elements associated with the products.  This has worked for years until we created and started using price books.  Now we get the following error when we try to unbundle the package:

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is in a different pricebook than the one assigned to the opportunity): [PricebookEntryId]

 

Class.ProductPackageUnbundle.unbundle: line 95, column 1

 

I have no APEX background but it appears that it is always trying to use the Standard Price book.  However, if I use the standard price book, I still get the error when I try to unbundle.  Any help anyone can provide as to what needs to be changed in the code would be greatly appreciated!

 

Here is the code:

 

public class ProductPackageUnbundle {
/*
  Onclick of Unbundle button on Opportunity Products related list
  Look for all opportunity line items with Record type of "Package"
  look to Master_Package_Product__c and insert products related and delete Package record
  use Selling amount from Package record if it is not null
  Create Configurtion elements using the default values.
  

 
*/
    public ProductPackageUnbundle(ApexPages.StandardController stdController) {
            
    }
    
    public final opportunity oppty = [select id,name,pricebook2id,currencyisocode from opportunity where id = :apexpages.currentpage().getparameters().get('id')];
    public final pricebook2 pb2 = [select id,name from pricebook2 where name = 'Standard Price Book'];
    public pagereference unbundle(){
    
      
      string sellingprice;
      //Select all opportunity line items that have a record type of "Package"
      recordtype rtype = [select id from recordtype where name = 'Package' and SobjectType='Product2' limit 1];
      if (rtype.id != null){
        system.debug('recordtype'+rtype.id);
      //selects all line items for opportunity that have record type of package
      list<opportunitylineitem> opliNew = [select id,pricebookentry.Product2Id,quantity from opportunitylineitem where pricebookentryid in (select id from pricebookentry where product2.RecordTypeId = :rtype.id) and opportunityid = :oppty.id];  
      
      if(opliNew.size()!=0){
        set<id> packageID = new set<id>();
        map<id,double> opliQty = new map<id,double>();
        for (opportunitylineitem opliLoop : opliNew){
          packageID.add(opliLoop.pricebookentry.product2id);
          opliQty.put(opliLoop.pricebookentry.product2Id,opliLoop.Quantity);  
        }
        
        list<master_package_product__c> mpp = [select id,name,product__c,package__c,master_configuration_element__c,package__r.name from master_package_product__c where package__c in :packageID and product__c != null];
        system.debug('MPP'+mpp);
        if(mpp.size()>0){
        // Loop through the records and create opportunity line items.
        set<string> mppPackageProduct = new set<string>();
        set<id> mppProduct = new set<id>();
        map<id,id> mppPackage = new map<id,id>();
        map<id,string> mppPackageName = new map<id,string>();
        for (Master_Package_Product__c mppLoop : mpp){
          mppProduct.add(mppLoop.product__c);
          mppPackageProduct.add((''+mppLoop.package__c + mppLoop.product__c));
          mppPackageName.put(mppLoop.package__c,mppLoop.package__r.name);
        }
        system.debug('mppProduct'+mppProduct);
        list<pricebookentry> pbe = [Select id,product2.Name, product2.description,product2.family,product2.Product_Solution__c,product2.Product_Category__c,product2.id,product2.type__c From pricebookentry Where product2.id in :mppProduct and isactive = true  limit 1000];
        // add pricebook entry to map used when looping through packages
        map<id,pricebookentry> pbeMap = new map<id,pricebookentry>();
        for (pricebookentry pbeLoop : pbe){
          pbeMap.put(pbeLoop.product2.id,pbeLoop);  
        }
        system.debug('PBEMAP'+pbeMap);
        list<opportunitylineitem> opliProduct = new list<opportunitylineitem>();
        string tempPackage;
        string tempProduct;
        
        for (string mppLoop2 : mppPackageProduct) {
              if(mppLoop2.length()==36){
                tempPackage = mppLoop2.substring(0,18);
                tempProduct = mppLoop2.substring(18,36);
              }else{
                tempPackage = '';
                tempProduct = '';
              }
              
              if(pbeMap.get(tempProduct)!=null){
                pricebookentry pbeTemp = pbeMap.get(tempProduct);
                  opportunitylineitem opliTemp = new opportunitylineitem();
                     system.debug('PBETEMP'+pbeTemp);
                  opliTemp.pricebookentryid=pbeTemp.id;
                
                //opliTemp.pricebookentryid=pbeLoop.Id;
                opliTemp.opportunityid=oppty.id;
                // for product type of service use qty from Original package
                //changed code to set qty to 1 except for Service with Qty other than 1 011711 DPC
                if(pbeTemp.product2.type__c == 'Service' && opliQty.get(tempPackage)!=null){
                  opliTemp.quantity = opliQty.get(tempPackage);
                  } else {
                  opliTemp.quantity = 1;
                }
                opliTemp.unitprice=0;
                if(mppPackageName.get(tempPackage)!= null){
                  opliTemp.Description = '' + mppPackageName.get(tempPackage);
                }
                opliTemp.OP_SFDC_ID__c = tempPackage;
                opliProduct.add(opliTemp);
          }
            }
            if(opliProduct.size()>0){
              insert opliProduct;
              //create Product Configuration Elements
              productPackageElements ppe = new productPackageElements();
              boolean fromPackage = true;
              string successCode = ppe.CreateElements(opliProduct, fromPackage);
              
              
              // Update the Percentage complete on Create
              productPackagePercentCalc pppc = new productPackagePercentCalc();
              pppc.updatePercentage(opliProduct);
              system.debug('\n\nDELETEOPLINEW'+opliNew);
              delete opliNew;
            }
        } else {
          //Error there should be products for packages
           ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'A package you selected has no products Call your Salesforce Administrator'));
        }
        //Lookup all related products from Master_Package_product
          
        
        
        
        
        PageReference opptyPage = new ApexPages.StandardController(oppty).view();
        opptyPage.setRedirect(true);
        return opptyPage;
      } else {
       ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'No Packages to Unbundle'));
       return null;
      }
      
      
    //End of Package code if statement
    }
      
      
      
    return null;  
    }
  public pagereference back(){
    //Sends the user back to the opportunity page
    PageReference opptyPage = new ApexPages.StandardController(oppty).view();
        opptyPage.setRedirect(true);
        return opptyPage;
  }


}