• MayankDkPant
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 27
    Replies

Hi,

 

I have 4 picklist fields on my vf page. How can I retrieve values of these field when user clicks onsearch button.

 

Scenario:

I don't wan to  use Controller.getRecord() method. Is there any way I can access them. I tried ApexPages.CurrentPage.GetParameters.Get() method but that method is not working. Is there any thing else I can use for them.


Any help will be appreicated.

 

With Regards,

Mayank Pant.

 

 

Hi,

 

I have writtern an Extension class for opportunity visual force page.

I have used 4 custom picklist  fields of opportunity on vf page, fields names are Product_Group__c,Product_Area__c,Product_Family__c,Product_Family_Child__c.

 

My problem is when I am running the test class is throwing an exception

SObject row was retrieved via SOQL without querying the requested field: Opportunity.Product_Group__c.

 

Class.opportunityProductEntryExtension.updateAvailableList: line 180, column 1 Class.opportunityProductEntryExtension.<init>: line 69, column 1 Class.productentry_test.mytest: line 73, column 1 [productentry_test. is my test class].

 

 

public opportunityProductEntryExtension(ApexPages.StandardController controller) 
    {
        objOpp= (Opportunity)controller.getRecord();
        
        // Need to know if org has multiple currencies enabled
        multipleCurrencies = UserInfo.isMultiCurrencyOrganization();

        // Get information about the Opportunity being worked on
        if(multipleCurrencies)
            theOpp = database.query('select Id, Product_Group__c, Product_Area__c, Product_Family__c, Product_Family_Child__c, Pricebook2Id, Pricebook2.Name, CurrencyIsoCode from Opportunity where Id = \'' + controller.getRecord().Id + '\' limit 1');
        else
            theOpp = [select Id,Product_Group__c, Product_Area__c, Product_Family__c, Product_Family_Child__c, Pricebook2Id, PriceBook2.Name from Opportunity where Id = :controller.getRecord().Id limit 1];
        
        // If products were previously selected need to put them in the "selected products" section to start with
        shoppingCart = [select Id,Product_Group__c,Product_Area__c,Product_families__c,Product_Child__c, Quantity, TotalPrice, UnitPrice, Description, PriceBookEntryId, PriceBookEntry.Name, PriceBookEntry.IsActive, PriceBookEntry.Product2Id, PriceBookEntry.Product2.Name, PriceBookEntry.PriceBook2Id from opportunityLineItem where OpportunityId=:theOpp.Id];

        // Check if Product hierarchy picklist is changed
        
        
        // Check if Opp has a pricebook associated yet
        if(theOpp.Pricebook2Id == null){
            Pricebook2[] activepbs = [select Id, Name from Pricebook2 where isActive = true limit 2];
            if(activepbs.size() == 2){
                forcePricebookSelection = true;
                theBook = new Pricebook2();
            }
            else{
                theBook = activepbs[0];
            }
        }
        else{
            theBook = theOpp.Pricebook2;
        }
        
        if(!forcePricebookSelection)
            updateAvailableList();
    }
 


public void updateAvailableList() 
    {
        //objOpp= (Opportunity)controller.getRecord();
        String qString;
        // We dynamically build a query string and exclude items already in the shopping cart
        
        String idOpp=System.currentPageReference().getParameters().get('id'); 
        Opportunity oppList=[SELECT Product_Group__c, Product_Area__c, Product_Family__c, 
                 Product_Family_Child__c FROM opportunity 
                 where id=:idOpp limit 1];
                 
       String sProductGroup =oppList.Product_Group__c;
       String sProductArea = oppList.Product_Area__c;
       String sProductFamily = oppList.Product_Family__c;
       String sProductChild = oppList.Product_Family_Child__c;
            
       If(oppList.Product_Group__c !=null && oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c!='Multiple' && oppList.Product_Family_Child__c!='Multiple')
        { 
            
            qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Product2.Product_Family__c= \'' + sProductFamily  + '\' and Product2.Product_Family_Child__c  =\''+ sProductChild+ '\' and Pricebook2Id = \'' + theBook.Id + '\'';
            if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
            if(searchString!=null)
            {
                qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
            }
            
            
        }
        
       If(oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c!='Multiple' &&  oppList.Product_Family_Child__c=='Multiple')
       {
           qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Product2.Product_Family__c= \'' + sProductFamily  + '\' and Pricebook2Id = \'' + theBook.Id + '\'';
            if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
            if(searchString!=null)
            {
                qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
            }
       }
       
       if(oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c=='Multiple')
       {
       
           qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Pricebook2Id = \'' + theBook.Id + '\'';
           if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
           if(searchString!=null)
           {
               qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
           }
       }
      if(oppList.Product_Area__c=='Multiple')
      {
          qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\'and Pricebook2Id = \'' + theBook.Id + '\'';
          if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
          
         if(searchString!=null)
          {
              qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode  like \'%' + searchString + '%\')';
          }
      }
      
        if (objOpp.Product_Group__c!=null)
         {   
             System.Debug('Product Group:'+ objOpp.Product_Group__c);
             qString+= ' and (Product2.Product_Group__c like \'%' + objOpp.Product_Group__c + '%\')';    
         }
         
         if (objOpp.Product_Area__c!=null)
         {   
             System.Debug('Product Area :'+ objOpp.Product_Area__c);
             qString+= ' and (Product2.Product_Area__c like \'%' + objOpp.Product_Area__c+ '%\')';    
         }
         if (objOpp.Product_Family__c!=null)
         {
             System.Debug('Product Family:'+ objOpp.Product_Family__c);
             qString+= ' and (Product2.Product_Family__c like \'%' + objOpp.Product_Family__c + '%\')';    
         }
         if (objOpp.Product_Family_Child__c!=null) 
         {
             System.Debug('Product Family Child:'+ objOpp.Product_Family_Child__c);
             qString+= ' and (Product2.Product_Family_Child__c  like \'%' + objOpp.Product_Family_Child__c + '%\')';    
         }
               
        Set<Id> selectedEntries = new Set<Id>();
        for(opportunityLineItem d:shoppingCart)
        {
            selectedEntries.add(d.PricebookEntryId);
        }
        
        if(selectedEntries.size()>0){
            String tempFilter = ' and Id not in (';
            for(Id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';
            
            qString+= extraFilter;
        }
        
        qString+= ' order by Product2.Name';
        qString+= ' limit 101';
        
        system.debug('qString:' +qString);        
        AvailableProducts = database.query(qString);
        
        // We only display up to 100 results... if there are more than we let the user know (see vf page)
        if(AvailableProducts.size()==101){
            AvailableProducts.remove(100);
            overLimit = true;
        }
        else{
            overLimit=false;
        }
    }

Hi,

 

I have used opportunity standard controller for vf page and has used 4 standard piclist fields.

 

How can i fetch the selected picklist values when user clicks on search button, so that I can perform custom search.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi,

 

I have created a Field Set for opportunity and added it to the visual force page.

Field set contains 4 picklist which are inter dependent.

 

Requirement: When user selects the piclist values in field set and click on search function, I want the to get piclist values in my apex code. Is there any way that I can retrieve the picklist value selected?

 

Any help wil be great.

 

With Regards,

Mayank Pant.

Hi,

 

I have created a custom visual force page for Product selection under opportunity. Now I want that when user checks the checkboxes for to be added to oppotunity and clicks on select button then I want my page to redirect to below url

https://cs9.salesforce.com/oppitm/multilineitem.jsp".

After doing this and when user clicks on select page it shows the below error

 

Unable to Access Page You are missing information needed by the page you have attempted to access. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.
Back

 

How can I pass the information to this page.


Any help will be appreciated.

 

With Regards,

Mayank Pant

 

 

Hi,

 

I have to add a new custom button on product related list in opportunty, but when I create a button of type list in Opportunity product object and clicks on visual force page it shows no content. For page to be displayed as content I need to take "recordsetvar" but recordsetvar is not acceptable for opportunityproduct object. What all possible scenarios I can have to achieve my requirement.

 

Going ahead I need a visual force page which displays all products and user can select the product(multiple) and add it to the opportunity.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi,

 

My requirement.

 

I have a custom object name "Platform": Which has a text field "Platform model".

I have a custom picklist on opportunity. I want that whenever a new "platform model" text value is added to platfrom record then that value should auto added in platform picklist in opportunity. How can I achieve this.

Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi,

 

My scenario:

 

I have a 4 picklist fields in opportunity and I have a program custom object which has same 4 picklist with same values.
I have a look-up relationship b/w opportunity and program. when user selects a program on opportunity level and clicks on save button I want the all 4 picklist values on opportunity object should be auto saved with their corresponding product values from program object.

 

My Problem: I have written a trigger that is working fine for one insert but it is not working for bulk insert.

My Trigger:

 

trigger trgautoPopulateProductVariation on Opportunity (before insert, before update)
{  
  Set<Id> idopp = new Set<Id>();
    Set<Id> idProg = new Set<Id>();


   for(Opportunity opp : trigger.new)
    {
        idopp.add(opp.id);        
        idProg.add(opp.Program__c);

    }
 
      List<Opportunity> oppList = [SELECT Id, Name,Product_Group__c, Product_Area__c,
                         Product_Family__c, Product_Family_Child__c  FROM opportunity
                       Where Id IN :idopp];    

    List<Program__c> progList = [Select Id,Product_Group__c,
                   Product_Area__c, Product__c, Product_Family_Child__c
                   From Program__c Where Id IN :idProg];
                   
   for(Opportunity opp : trigger.new)
   { Integer i=0;
     for(Program__c prog: progList)
              {
                   if(prog.id==opp.Program__c)
                    {
                        trigger.new[i].Product_Group__c =prog.Product_Group__c;
                        trigger.new[i].Product_Area__c = prog.Product_Area__c;
                        trigger.new[i].Product_Family__c = prog.Product__c;
                        trigger.new[i].Product_Family_Child__c = prog.Product_Family_Child__c;
                        System.debug('I value = '+i);
                     }
              }  
              
       i++;
   }
       
 }

 

Can any one help me out on this. Any help will be appreciated.

 

With Regards,

Mayank Pant

 

Hi,

 

I can not find any way to filter the products on Product selection page while adding it to opportunity. I have created a custom picklist fields on Products objects and same fields on opportunity object. I want that only those products should come up for selection whose values is same as the value of opportunity fields.

 

Like If opp has P1, P2 picklist and Product has same P1 and P2 fields then those products should appear whose p1 and p2 has same values as that of current opportunity.

 

Can we do it without filters.

Any help will pe appreciated

Thanks in advance.

 

With Regards,

Mayank Pant

Hi,

 

My scenario:

  I have a custom object A and opportunity has a look-up relationship with this object.

  For custom Object A : I have 4 fields: F1, F2, F3, F4.(Picklist)

 In opportunity object also I have 4 fields of same type(Picklist) with same list of values.

 

Requrirement:

 

 When user saves the record for opportunity object then based on record A selectd by user via look-up relation ship, all the values for F1, F2,F3,F4 for 'A' record should be auto saved /inserted for opportunity record.

 

Can any one tell me how to achieve this using trigger as we don't have this feature using workflow.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant

 

Hi,

 

I have to integrate Salesforce with Client application(Java based). I have downloaded latest version of the WSC (currently wsc-20.jar) and the pre-compiled Partner library (partner-18.jar) from "http://code.google.com/p/sfdc-wsc/downloads/list". But when I try to run command

"java -classpath wsc-20.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar "

it says failed to load manfiest file from wsc.

I checked manifest file from wsc but there is no main class mentioned in manifest file. How can I create a main class in manifest file so that I can move ahead with my task.

 

Any help will be appreciated. Thanks in advance.

 

With Regards,
Mayank Pant

 

Hi,

 

I have enabled salesforce 2 salesforce connection. But in my target org the account I have shared shows the message that is externally shared. How can I remove this message from account layout page.

 

Any help will be appreciated. Thanks in advance.

 

With Regards,

Mayank Pant.

Hi,

 

My scenarion:  On contact page layout I have to show a warning message with info image in it. Warning message consist of 300 characters.  I had achieved it using visual force page but is there any way or any control on which I can write the message with image and display it as a section below contact information section in salesforce. I am not able to find any way at my own for this.

 

I have added the screen shot.

 

Any help will be greatly appreciated. Thank in advance.

 

With Regards,

Mayank Pant

Hi,

 

Is there any way to make address fields requred from page layout without using validation rule on contact page.

 

I am not able to find any way to do this.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant.

Hi,

 

My scenario is : I have a field of Number type and whose decimal point is set to 0.

 

If user enters any decimal data then it should show a validation message "Only numeric Values". But I can not achieve this. Can any one tell me how to use Reges to restrict user from entering any decimal no.

 

I am facing two problems. -

 

1. Can we have Regex on Numeric type field.

2. REGEX(NPS_Score__c ," ^[-+]?\\d+(\\.\\d+)?$"). i am using this expression to check if it contains and decimal then it will return true and error message will be flashed. I am getting "Incorrect Argument Type error".

 

Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

Hi,

 

As per OOB, when ever we associate a contact with an account, accounts billing addess auto-populates to mailing address of contact. But when I am uploading a contact using apex data loader and I have the accountid field to contact in .csv file even then it's address does not auto-pupolates. Can be handles using some setting or there is no way for it.

 

Any help will be appreciated.Thanks in advance.

With Reagards,

Mayank Pant

Hi,

 

My requirement is that I want to either move OOB googlemap to address section page for a contact or create a new custom link in address section of contact. But I can't do either of it. Is there any option to place custom link on address section.

 

Any help will be appreciated. Thanks in advance.

 

With Regards,

Mayank Pant

Hi,

 

My scenarion: There is a field f1 in Account page which user's of Profile say P1 can not edit(Field is not read-only) because we have used validation rule to stop them from editing. What bussiness wants is that there are some users of P1 profile which have permission set. If any user with this permissin set is changing the record of field f1 then validation should not trigger. I can not find any permission sets in insert field option for a validation. Is there any way I can use permission sets in validation rule.

 

Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

 

Hi,

 

I have created a field in contact page and that field is updated by a workflow from another object. That field is visible to everyone but not editable. I want that field to be removed from contact page when we create a contact and should only be shown in Detail page. Is there any way to acheive this functionality.

 

With Regards,

Mayank Pant

 

Hi,

 

My requirement is that when user clicks on a save button for contact record, then a warning message should pop up displaying some info with continue button. Is there any way to achieve it without writing a visual force page.

 

If visual force is the only option than how can we achieve this using visual force. Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

 

Hi,

 

I have writtern an Extension class for opportunity visual force page.

I have used 4 custom picklist  fields of opportunity on vf page, fields names are Product_Group__c,Product_Area__c,Product_Family__c,Product_Family_Child__c.

 

My problem is when I am running the test class is throwing an exception

SObject row was retrieved via SOQL without querying the requested field: Opportunity.Product_Group__c.

 

Class.opportunityProductEntryExtension.updateAvailableList: line 180, column 1 Class.opportunityProductEntryExtension.<init>: line 69, column 1 Class.productentry_test.mytest: line 73, column 1 [productentry_test. is my test class].

 

 

public opportunityProductEntryExtension(ApexPages.StandardController controller) 
    {
        objOpp= (Opportunity)controller.getRecord();
        
        // Need to know if org has multiple currencies enabled
        multipleCurrencies = UserInfo.isMultiCurrencyOrganization();

        // Get information about the Opportunity being worked on
        if(multipleCurrencies)
            theOpp = database.query('select Id, Product_Group__c, Product_Area__c, Product_Family__c, Product_Family_Child__c, Pricebook2Id, Pricebook2.Name, CurrencyIsoCode from Opportunity where Id = \'' + controller.getRecord().Id + '\' limit 1');
        else
            theOpp = [select Id,Product_Group__c, Product_Area__c, Product_Family__c, Product_Family_Child__c, Pricebook2Id, PriceBook2.Name from Opportunity where Id = :controller.getRecord().Id limit 1];
        
        // If products were previously selected need to put them in the "selected products" section to start with
        shoppingCart = [select Id,Product_Group__c,Product_Area__c,Product_families__c,Product_Child__c, Quantity, TotalPrice, UnitPrice, Description, PriceBookEntryId, PriceBookEntry.Name, PriceBookEntry.IsActive, PriceBookEntry.Product2Id, PriceBookEntry.Product2.Name, PriceBookEntry.PriceBook2Id from opportunityLineItem where OpportunityId=:theOpp.Id];

        // Check if Product hierarchy picklist is changed
        
        
        // Check if Opp has a pricebook associated yet
        if(theOpp.Pricebook2Id == null){
            Pricebook2[] activepbs = [select Id, Name from Pricebook2 where isActive = true limit 2];
            if(activepbs.size() == 2){
                forcePricebookSelection = true;
                theBook = new Pricebook2();
            }
            else{
                theBook = activepbs[0];
            }
        }
        else{
            theBook = theOpp.Pricebook2;
        }
        
        if(!forcePricebookSelection)
            updateAvailableList();
    }
 


public void updateAvailableList() 
    {
        //objOpp= (Opportunity)controller.getRecord();
        String qString;
        // We dynamically build a query string and exclude items already in the shopping cart
        
        String idOpp=System.currentPageReference().getParameters().get('id'); 
        Opportunity oppList=[SELECT Product_Group__c, Product_Area__c, Product_Family__c, 
                 Product_Family_Child__c FROM opportunity 
                 where id=:idOpp limit 1];
                 
       String sProductGroup =oppList.Product_Group__c;
       String sProductArea = oppList.Product_Area__c;
       String sProductFamily = oppList.Product_Family__c;
       String sProductChild = oppList.Product_Family_Child__c;
            
       If(oppList.Product_Group__c !=null && oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c!='Multiple' && oppList.Product_Family_Child__c!='Multiple')
        { 
            
            qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Product2.Product_Family__c= \'' + sProductFamily  + '\' and Product2.Product_Family_Child__c  =\''+ sProductChild+ '\' and Pricebook2Id = \'' + theBook.Id + '\'';
            if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
            if(searchString!=null)
            {
                qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
            }
            
            
        }
        
       If(oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c!='Multiple' &&  oppList.Product_Family_Child__c=='Multiple')
       {
           qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Product2.Product_Family__c= \'' + sProductFamily  + '\' and Pricebook2Id = \'' + theBook.Id + '\'';
            if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
            if(searchString!=null)
            {
                qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
            }
       }
       
       if(oppList.Product_Area__c!='Multiple' && oppList.Product_Family__c=='Multiple')
       {
       
           qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\' and Product2.Product_Area__c= \'' + sProductArea  + '\' and Pricebook2Id = \'' + theBook.Id + '\'';
           if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
           if(searchString!=null)
           {
               qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode like \'%' + searchString + '%\')';
           }
       }
      if(oppList.Product_Area__c=='Multiple')
      {
          qString = 'select Id, Pricebook2Id, IsActive, Product2.Name, Product2.Family, Product2.IsActive, Product2.Description, UnitPrice from PricebookEntry where IsActive=true and Product2.Product_Group__c= \'' + sProductGroup + '\'and Pricebook2Id = \'' + theBook.Id + '\'';
          if(multipleCurrencies)
                qstring += ' and CurrencyIsoCode = \'' + theOpp.get('currencyIsoCode') + '\'';
            
            // note that we are looking for the search string entered by the user in the name OR description
            // modify this to search other fields if desired
          
         if(searchString!=null)
          {
              qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.productcode  like \'%' + searchString + '%\')';
          }
      }
      
        if (objOpp.Product_Group__c!=null)
         {   
             System.Debug('Product Group:'+ objOpp.Product_Group__c);
             qString+= ' and (Product2.Product_Group__c like \'%' + objOpp.Product_Group__c + '%\')';    
         }
         
         if (objOpp.Product_Area__c!=null)
         {   
             System.Debug('Product Area :'+ objOpp.Product_Area__c);
             qString+= ' and (Product2.Product_Area__c like \'%' + objOpp.Product_Area__c+ '%\')';    
         }
         if (objOpp.Product_Family__c!=null)
         {
             System.Debug('Product Family:'+ objOpp.Product_Family__c);
             qString+= ' and (Product2.Product_Family__c like \'%' + objOpp.Product_Family__c + '%\')';    
         }
         if (objOpp.Product_Family_Child__c!=null) 
         {
             System.Debug('Product Family Child:'+ objOpp.Product_Family_Child__c);
             qString+= ' and (Product2.Product_Family_Child__c  like \'%' + objOpp.Product_Family_Child__c + '%\')';    
         }
               
        Set<Id> selectedEntries = new Set<Id>();
        for(opportunityLineItem d:shoppingCart)
        {
            selectedEntries.add(d.PricebookEntryId);
        }
        
        if(selectedEntries.size()>0){
            String tempFilter = ' and Id not in (';
            for(Id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';
            
            qString+= extraFilter;
        }
        
        qString+= ' order by Product2.Name';
        qString+= ' limit 101';
        
        system.debug('qString:' +qString);        
        AvailableProducts = database.query(qString);
        
        // We only display up to 100 results... if there are more than we let the user know (see vf page)
        if(AvailableProducts.size()==101){
            AvailableProducts.remove(100);
            overLimit = true;
        }
        else{
            overLimit=false;
        }
    }

Hi,

 

I have to add a new custom button on product related list in opportunty, but when I create a button of type list in Opportunity product object and clicks on visual force page it shows no content. For page to be displayed as content I need to take "recordsetvar" but recordsetvar is not acceptable for opportunityproduct object. What all possible scenarios I can have to achieve my requirement.

 

Going ahead I need a visual force page which displays all products and user can select the product(multiple) and add it to the opportunity.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi,

 

My scenario:

  I have a custom object A and opportunity has a look-up relationship with this object.

  For custom Object A : I have 4 fields: F1, F2, F3, F4.(Picklist)

 In opportunity object also I have 4 fields of same type(Picklist) with same list of values.

 

Requrirement:

 

 When user saves the record for opportunity object then based on record A selectd by user via look-up relation ship, all the values for F1, F2,F3,F4 for 'A' record should be auto saved /inserted for opportunity record.

 

Can any one tell me how to achieve this using trigger as we don't have this feature using workflow.

 

Any help will be appreciated.

 

With Regards,

Mayank Pant

 

Hi,

 

My scenarion:  On contact page layout I have to show a warning message with info image in it. Warning message consist of 300 characters.  I had achieved it using visual force page but is there any way or any control on which I can write the message with image and display it as a section below contact information section in salesforce. I am not able to find any way at my own for this.

 

I have added the screen shot.

 

Any help will be greatly appreciated. Thank in advance.

 

With Regards,

Mayank Pant

Hi,

 

My scenario is : I have a field of Number type and whose decimal point is set to 0.

 

If user enters any decimal data then it should show a validation message "Only numeric Values". But I can not achieve this. Can any one tell me how to use Reges to restrict user from entering any decimal no.

 

I am facing two problems. -

 

1. Can we have Regex on Numeric type field.

2. REGEX(NPS_Score__c ," ^[-+]?\\d+(\\.\\d+)?$"). i am using this expression to check if it contains and decimal then it will return true and error message will be flashed. I am getting "Incorrect Argument Type error".

 

Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

Hi,

 

As per OOB, when ever we associate a contact with an account, accounts billing addess auto-populates to mailing address of contact. But when I am uploading a contact using apex data loader and I have the accountid field to contact in .csv file even then it's address does not auto-pupolates. Can be handles using some setting or there is no way for it.

 

Any help will be appreciated.Thanks in advance.

With Reagards,

Mayank Pant

Hi,

 

My requirement is that I want to either move OOB googlemap to address section page for a contact or create a new custom link in address section of contact. But I can't do either of it. Is there any option to place custom link on address section.

 

Any help will be appreciated. Thanks in advance.

 

With Regards,

Mayank Pant

Hi,

 

My scenarion: There is a field f1 in Account page which user's of Profile say P1 can not edit(Field is not read-only) because we have used validation rule to stop them from editing. What bussiness wants is that there are some users of P1 profile which have permission set. If any user with this permissin set is changing the record of field f1 then validation should not trigger. I can not find any permission sets in insert field option for a validation. Is there any way I can use permission sets in validation rule.

 

Any help will be appreciated. Thank in advance.

 

With Regards,

Mayank Pant

 

Hi,

 

I have two Objects A and B. A is master and B is child.

My scenario : When ever new record is created in B or whenever existing record is updated in B then, value in object A should also get updated based on most recent value of B.

 

Ex: If value added to B is 6 then it should be reflected in A as 6.

I have done this using trigger but I want it through workflow. Is there any option for doing this. Any help will be appreciated.

 

With Regards,

Mayank Pant

Hi All,

 

I have Parent account and child account. Contacts can only be added to parent account and contact roles to child account. Contact and contact role related list has to be shown on parent and child account. When user clicks on new button in contact role related list  in the parent account, I want to restrict user from adding contact role for the parent account.

 

Is there any validation possible like we have for contact. Any help will be greatly appreciated. I want to do it through customization only.

 

Thanks in advance.


With Regards,

Mayank Pant

Hi All,i have overridden edit button for a particular requirement such that if i edit a record of a particular record type it should get directed to visual force page else it  should be directed to standard page.But when i direct to a standard page the inline editing gets disabled for the standard page.Please provide some solution.

 

The second one is on overriding edit button the  security of the profiles also gets overridden.... which will lead to security issues

 

 

Guys Any pointers on this ???

Is it possible to add picklist values (the metadata) using apex and a VF page?

 

I have a VF page that displays the lead source picklist values from the contact object on a VF page:

 

public List<SelectOption> getLeadSourceNames()
	{
  		List<SelectOption> options = new List<SelectOption>();
        
   		Schema.DescribeFieldResult fieldResult = Contact.LeadSource.getDescribe();
   		
   		List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   		for( Schema.PicklistEntry f : ple)
   		{
      		options.add(new SelectOption(f.getLabel(), f.getValue()));
   		}       
   		return options;
	}

 

On my VF page, I display the selectList and if the user select 'Other' it will open a text field where they can enter a new value and save.  It saves the value to the record, but doesn't add the new value to the actual picklist value metadata.  Is there a ay to do this?

 

Here is my VF page:

 

<apex:page standardController="Contact" extensions="DynamicPicklist" sidebar="false" >
	<apex:form >
		<apex:sectionHeader title="Dynamic Picklist" subtitle="Reusable code"/>
		<apex:pageblock >
			<apex:pageBlockSection title="Dynamic picklist" columns="1">      
				<apex:pageblocksectionItem >          
					<apex:outputlabel value="Lead Source" for="values" />          
					<apex:selectList value="{!leadSource}" size="1" id="values">              
						<apex:actionSupport event="onchange" reRender="newvalue" />              
						<apex:selectOptions value="{!leadSourceNames}"/>          
					</apex:selectList>      
				</apex:pageblocksectionItem>                                                  
				<apex:outputpanel id="newvalue">             
					<apex:outputpanel rendered="{!leadSource == 'Other'}">             
						<div style="position:relative;left:75px;">                               
							<apex:outputlabel value="New value" for="newval" />                  
							<apex:inputText value="{!newpicklistvalue}" id="newval"/>                  
							<apex:commandbutton action="{!saverec}" value="Add!"/>             
						</div>             
					</apex:outputpanel>          
				</apex:outputpanel>               
			</apex:pageblocksection>
		</apex:pageblock>
	</apex:form>
</apex:page>

 

Here is the saverec method:

 

public void saverec(){   
	con.LeadSource = newpicklistvalue;
	update con; 	
}

 

I would like to have the ability to add new picklist values from the VF page.  Is it possible using the metadata API?  If so, how?  I can't find any sample code that explains how to accomplish this.

 

Thanks for any help.