• Leo Barnoski
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
I'm brand new to Salesforce REST API.
I need to send a GET request to query a list of records.
Everything works great in Workbench, that means my apex class is fine.

But, when I try to do the same from Postman, I keep receiving an "errorCode":"INVALID_SESSION_ID". I followed step-by-step this (http://www.youtube.com/watch?v=WdAhD6p1nKM)video and created my connected app exactly as he does.
User-added image
In Postman, I can correctly get the security token, but when sending the request I still can't authenticate.
User-added imageI'm trying all this in a Sandbox of which I'm an administrator. Can the error be due to some app permission settings I'm not aware of? 

 
Hi,
I am trying to get a test class written for this trigger that adds a child record after the creation of the parent record. I am getting the following error -
"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, jstcl.PlacementTeamMember: execution of BeforeInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Class.jstcl.PlacementTeamMemberTriggerHandler.validateTeamMembers: line 14, column 1
Trigger.jstcl.PlacementTeamMember: line 2, column 1: []"

trigger:
trigger autoAddNAM_VAM on ts2__Placement__c (after insert) {
    List<jstcl__PlacementTeamMember__c> teamMems = new List<jstcl__PlacementTeamMember__c>();
     Set<Id> tsClientSet = new Set<id>();
      Map<ID, Account> tsClientmap = new Map<ID, Account> ();   // Check the API Name of ts2__Client__c object
 for(ts2__Placement__c newTeamMem : Trigger.New)
    {
        
        if(newTeamMem.ts2__Client__c != null)
        {
            
            tsClientSet.add(newTeamMem.ts2__Client__c);
        }
    }
    
    if(tsClientSet.size() > 0)
    {
        tsClientmap = new Map<ID, Account>([SELECT Id, VAM_or_NAM_Member__c from Account where Id IN: tsClientSet]);
    }
    for(ts2__Placement__c newTeamMem : Trigger.New){

        if(tsClientmap.Containskey(newTeamMem.ts2__Client__C))
        {
                      
  try{ 
            if (tsClientmap.get(newTeamMem.ts2__Client__C).VAM_or_NAM_Member__c != null ){
                teamMems.add(new jstcl__PlacementTeamMember__c(
                        jstcl__Placement__c = newTeamMem.Id,
                        jstcl__User__c = tsClientmap.get(newTeamMem.ts2__Client__C).VAM_or_NAM_Member__c,
                        jstcl__CommissionPlan__c = [Select jstcl__Commission_Plan__c
                                                    FROM jstcl__TG_Commission_Plan_Assignment__c 
                                                    WHERE jstcl__Commission_Plan__r.Name LIKE '%Plan%' AND jstcl__User__c = :tsClientmap.get(newTeamMem.ts2__Client__C).VAM_or_NAM_Member__c].jstcl__Commission_Plan__c,
                        jstcl__SplitPercent__c = 100));
            }
  }catch(exception e){
       System.debug('The following exception has occurred: ' + e.getMessage());
  }   
        
    }
   
    insert teamMems;
    }
}

test:
@isTest
public class addNAM_VAMtest {
	
    static testmethod void test1(){
        ts2__Placement__c plc = new ts2__Placement__c(ts2__Client__c = '00137000008cDfrAAE');
		account acct = new account(VAM_or_NAM_Member__c = '00537000003tZkqAAE', Name = 'Northwestern Medicine');  
        jstcl__PlacementTeamMember__c ptm = new jstcl__PlacementTeamMember__c(jstcl__Placement__c = 'a211G000001NrqRQAS', jstcl__User__c = '00537000003tZkqAAE',
                                                                              jstcl__CommissionPlan__c = 'a4g370000008PGJAA2', jstcl__SplitPercent__c = 100);
        
        insert acct;
        insert ptm;
    }
}

 
I have created the following cutomer health formula field that works perfectly.

IF( ISPICKVAL( Successful_Health_Check__c ,"No" ) ,0,10 )+
IF( ISPICKVAL( Usage_at_Expected_level__c ,"No" ) ,0,25 ) + 
IF( ISPICKVAL( All_Licenses_Paid_For__c  ,"No" ) ,0,10 ) + 
IF( ISPICKVAL( NPS_Greater_Than_6__c ,"No" ) ,0,20 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"3 Months" ) ,0,0 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"6 Months" ) ,0,10 ) + 
IF( ISPICKVAL( Last_In_Person_Meeting_Time_Frame__c ,"12 Months" ) ,0,30 ) + 
IF( ISPICKVAL( Change_in_Management__c ,"Yes" ) ,0,5 ) +
IF( ISPICKVAL( Overdue_30_Days__c ,"Yes" ) ,0,20 ) +
IF( ISPICKVAL( Overdue_60_Days__c  ,"Yes" ) ,0,35 ) +
IF( ISPICKVAL( Level_2_Support_Tickets__c  ,"Yes" ) ,0,55 ) +
IF( ISPICKVAL( Identified_Red_Flag_Issue__c  ,"Yes" ) ,0,55 )

We are categorizing customers into 3 categories based on the score that is calcuated from this formula.

Green = 0 - 30 
Yellow = 31 - 51 
Red 51- 9999

I would like to create a formula field that indicates their status and gives a visual indicator.  I have the following formula in an opporuntiy field that works well in categorizing Opps by Stage.

IMAGE(
CASE(StageName , 
"Negotiating Price & Implementation", "/img/samples/light_green.gif",
"Qualifying", "/img/samples/light_yellow.gif",
"Closed Lost", "/img/samples/light_red.gif",
"/s.gif"),
"status color")

I am having a tough time modifying that formula to show Red, Yellow or Green based on the following scoring tiers:

Green = 0 - 30 
Yellow = 31 - 51 
Red 51- 9999

Any ideas would be most appreciated
Hi Friends,
I am stuck at this for quite some time. the error is given below:

System.LimitException: Apex CPU time limit exceeded
Error is in expression '{!Process}' in component <apex:commandButton> in page quoteforaccounts: Class.QuoteUtilities.setMaInfor: line 21, column 1

Here is my method: 
Please help me out
public static void setMaInfor(Quote__c eq, list<Quote_Si__c> qsList, list<Quote_Pr__c> quoteTerms, list<KA_Mar_Elect__c> elecMargins, list<KA_Mar_Gas__c> gasMargins) {
        String type;
        String product;
        Decimal margin;
        Quote__c equote;
        Decimal count = 0;
        Decimal runner = 0;
        Decimal bestRunner = 0;
        Decimal currentMultiplier = 0;
        Boolean firstRun = true;
        Opportunity op;
    
        //Get list of all quote term prices that are selected
        
        List<Quote_Pr__c> qtpList = quoteTerms;
        //Get list of all KA Margin Electricity records
        List<KA_Mar_Elect__c> marElec = elecMargins;
	
	// newBEIndex
        firstRun = true;
	for(KA_Mar_Elect__c me : marElec){
                        if(firstRun){
                            bestRunner = math.abs(me.margin_mwh__c - newBEMargin);
                            currentMultiplier = me.index_new__c;
                            firstRun = false;
                        }else{
                            runner = math.abs(me.margin_mwh__c - newBEMargin);
                            if(runner < bestRunner){
                                bestRunner = runner;
                                currentMultiplier = me.index_new__c;
                            }
                        }
                    }

}

 
I'm working on trying to integrate functionality with the Edmunds API and I'm having trouble getting the exact values I want from the JSON response.  My code so far is this:
public with sharing class CM_VINDecode {

	private static final String URLprefix = 'https://api.edmunds.com/api/vehicle/v2/vins/';
	private static final String URLend = '?fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';    
	
	private static final String ULRStylePrefix = 'https://api.edmunds.com/api/vehicle/v2/styles/';
	private static final String URLStyleEnd = '/equipment?availability=standard&equipmentType=OTHER&fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';
	
	public string url	{get;set;}
	public string url2	{get;set;}
	public string vin	{get;set;}
	public string trim	{get;set;}
	public string styleID	{get;set;}
	public List<String> features	{get;set;}
	
	private static final String ELEMENT_MAKE = 'name';
    private static final String ELEMENT_MODEL = 'model';
    	
  	public void setVin(){
  		features = new list<String>();
  		url = URLprefix + vin + URLend;
  		getCalloutResponseContents(url);
  		}
  
  
  	// Pass in the endpoint to be used using the string url
	public String getCalloutResponseContents(String url) {
		// Instantiate a new HTTP request
    	Http h = new Http();
    	HttpRequest req = new HttpRequest();
    	req.setEndpoint(url);
    	req.setMethod('GET');

    	// Send the request, and parse response
    	HttpResponse res = h.send(req);
    	system.debug('Response: ' + res.getBody());
    	
		JSONParser parser = JSON.createParser(res.getBody());
    	
    	while (parser.nextToken() != null) {
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'trim')) {
                // Get the value.
                parser.nextToken();
                trim = parser.getText();
            	system.debug('Trim: ' + trim);
            	}
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'styles')) {
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	styleID = parser.getText();
                system.debug('StyleID: ' + styleID);
                }    
                }
        
        url2 = ULRStylePrefix + styleID + URLStyleEnd;
        	
        getStyle(url2);
		return null;
		}
		
	public String getStyle(String url2) {
		// Instantiate request
    	Http h = new Http();
    	HttpRequest req2 = new HttpRequest();
    	req2.setEndpoint(url2);
    	req2.setMethod('GET');
		
		// Send the request, and parse response
    	HttpResponse res2 = h.send(req2);
    	system.debug('Response: ' + res2.getBody());
    	
    	string jsonString = res2.getBody();
    	
    	Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(jsonString);
    	List<Object> e = (List<Object>)m.get('equipment');
    	
    	system.debug('Equipment: ' + e);
    	set<string> clr = new set<string>();
    	for(integer i = 0; i < m.size(); i++){
    	Map<String,Object> m2 = (Map<String,Object>)e[i];
    	    system.debug('M2' + m2);
    	    for(Object c : m2.values()){
    			string b =  string.valueOf(m2.get('name'));
    			features.add(b);
    			}
    		}
    		clr.addAll(features);
    		features.clear();
    		features.addAll(clr);
    	
    	   system.debug('Features: ' + features); 	
    	return null;
		}
		
	public class Equipment {
		public String id;
		public String name;
		public String equipmentType;
		public String availability;
		public List<Attributes> attributes;
		}

	public List<Equipment> equipment;
	public Integer equipmentCount;

	public class Attributes {
		public String name;
		public String value;
	}
	
	public static CM_VINDecode parse(String json) {
		system.debug('Result: ' + (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class));
		return (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class);
	}	
	
}
And this is the response JSON I've been working with:
{"equipment":[{"id":"20072640525","name":"Cargo Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cargo Capacity, All Seats In Place","value":"34.1"},{"name":"Cargo Capacity, Rear Seat Down Or Removed","value":"65.4"},{"name":"Max Cargo Capacity","value":"65.4"}]},{"id":"20072640526","name":"Mobile Connectivity","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Satellite Communications","value":"MAZDA CONNECT"},{"name":"Bluetooth","value":"Bluetooth"}]},{"id":"20072640528","name":"Instrumentation","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"External Temperature Gauge","value":"external temperature display"},{"name":"Tire Pressure Monitoring System","value":"tire pressure monitoring"},{"name":"Tachometer","value":"tachometer"},{"name":"Trip Computer","value":"trip computer"},{"name":"Clock","value":"clock"}]},{"id":"20072640529","name":"Misc. Exterior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Spoiler","value":"rear spoiler"},{"name":"Exterior Camera","value":"rear view camera"}]},{"id":"20072640530","name":"Doors","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Liftgate Window","value":"fixed"},{"name":"Rear Door Type","value":"liftgate"},{"name":"Number Of Doors","value":"4"}]},{"id":"20072640531","name":"Exterior Lights","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Fog Lights","value":"front fog/driving lights"},{"name":"Headlights Auto Delay","value":"auto delay off"},{"name":"Daytime Running Lights","value":"daytime running lights"},{"name":"Headlights Dusk Sensor","value":"dusk sensing"}]},{"id":"20072640534","name":"Front Passenger Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Passenger Seat","value":"height adjustable"},{"name":"Number Of Passenger Seat Manual Adjustments","value":"6"},{"name":"Heated Passenger Seat","value":"multi-level heating"}]},{"id":"20072640536","name":"Steering","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Steering","value":"electric power steering"}]},{"id":"20072640537","name":"1st Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seat Type","value":"bucket"},{"name":"Adjustable Seat Headrest","value":"height adjustable headrests"},{"name":"1st Row Upholstery","value":"leather"},{"name":"Number Of 1st Row Headrests","value":"2"},{"name":"Seat Whiplash Protection","value":"whiplash protection system"}]},{"id":"20072640538","name":"Interior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Leg Room","value":"39.3"},{"name":"1st Row Hip Room","value":"55.2"},{"name":"2nd Row Shoulder Room","value":"55.5"},{"name":"1st Row Head Room","value":"39.0"},{"name":"1st Row Leg Room","value":"41.0"},{"name":"2nd Row Head Room","value":"39.0"},{"name":"2nd Row Hip Room","value":"53.7"},{"name":"Epa Interior Volume","value":"136.4"},{"name":"1st Row Shoulder Room","value":"57.5"}]},{"id":"20072640539","name":"Spare Tire/Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Spare Tire Mount Location","value":"inside"},{"name":"Spare Tire Size","value":"temporary"}]},{"id":"20072640541","name":"Power Outlets","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Outlet(s)","value":"12V"}]},{"id":"20072640543","name":"Exterior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Overall Width Without Mirrors","value":"72.4"},{"name":"Wheelbase","value":"106.3"},{"name":"Minimum Ground Clearance","value":"8.5"},{"name":"Overall Length","value":"179.3"},{"name":"Overall Height","value":"67.3"}]},{"id":"20072640544","name":"Windows","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Privacy Glass","value":"privacy glass"},{"name":"Rain Sensing Front Wipers","value":"rain sensing"},{"name":"One Touch Windows","value":"1"},{"name":"Power Windows","value":"power windows"},{"name":"Rear Wiper","value":"intermittent rear wiper"},{"name":"Intermittent Front Wipers","value":"variable intermittent"},{"name":"Rear Defogger","value":"rear defogger"}]},{"id":"20072640545","name":"Steering Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Steering Wheel Adjustments","value":"tilt and telescopic"},{"name":"Cruise Controls On Steering Wheel","value":"cruise controls"},{"name":"Steering Wheel Trim","value":"leather and simulated alloy"},{"name":"Audio Controls On Steering Wheel","value":"audio controls"},{"name":"Phone Controls On Steering Wheel","value":"phone controls on steering wheel"}]},{"id":"20072640548","name":"Storage","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cupholders Location","value":"front and rear"},{"name":"Seatback Storage","value":"front seatback storage"},{"name":"Door Pockets Location","value":"front and rear"},{"name":"Overhead Console","value":"overhead console with storage"},{"name":"Center Console","value":"front console with storage"}]},{"id":"20072640549","name":"Sunroof","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"One Touch Power Sunroof","value":"one-touch power sunroof"},{"name":"Sunroof","value":"power glass"}]},{"id":"20072640550","name":"Seating Configuration","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seating Capacity","value":"2"},{"name":"2nd Row Seating Capacity","value":"3"}]},{"id":"20072640551","name":"Air Conditioning","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Air Conditioning Zones","value":"dual"},{"name":"Front Air Conditioning","value":"automatic climate control"},{"name":"Rear Heat","value":"rear ventilation ducts"},{"name":"Air Filtration","value":"interior air filtration"}]},{"id":"20072640552","name":"Differential","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Final Drive Ratio","value":"4.62"},{"name":"Limited Slip Center Differential","value":"limited slip center differential"}]},{"id":"20072640553","name":"Seatbelts","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Center Seatbelt","value":"3-point belt"}]},{"id":"20072640554","name":"Suspension","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Suspension Classification","value":"independent"},{"name":"Rear Spring Type","value":"coil springs"},{"name":"Independent Suspension","value":"four-wheel"},{"name":"Rear Suspension Classification","value":"independent"},{"name":"Front Stabilizer Bar","value":"stabilizer bar"},{"name":"Front Spring Type","value":"coil springs"},{"name":"Rear Stabilizer Bar","value":"stabilizer bar"}]},{"id":"20072640556","name":"Specifications","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Gross Vehicle Weight","value":"4566"},{"name":"Ege Highway Mpg","value":"30"},{"name":"Epa City Mpg","value":"24"},{"name":"Fuel Capacity","value":"15.3"},{"name":"Ege Combined Mpg","value":"26"},{"name":"Manufacturer 0 60mph Acceleration Time (seconds)","value":"7.8"},{"name":"Epa Highway Mpg","value":"30"},{"name":"Epa Combined Mpg","value":"26"},{"name":"Payload","value":"977"},{"name":"Curb Weight","value":"3589"},{"name":"Turning Diameter","value":"36.7"},{"name":"Tco Curb Weight","value":"3589"},{"name":"Ege City Mpg","value":"24"},{"name":"Towing Capacity","value":"2000"}]},{"id":"20072640557","name":"Brake System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Brake Type","value":"disc"},{"name":"Front Brake Type","value":"ventilated disc"},{"name":"Antilock Braking System","value":"4-wheel ABS"},{"name":"Braking Assist","value":"braking assist"}]},{"id":"20072640558","name":"Drive Type","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Driven Wheels","value":"all wheel drive"}]},{"id":"20072640559","name":"Misc. Interior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cruise Control","value":"cruise control"},{"name":"Floor Mats","value":"floor mats"},{"name":"Floor Mat Material","value":"carpet"}]},{"id":"20072640560","name":"Collision Safety System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Accident Avoidance System","value":"blind spot warning"},{"name":"Post Collision Safety System","value":"post-collision safety system"}]},{"id":"20072640562","name":"Driver Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Driver Seat","value":"height adjustable"},{"name":"Driver Seat Adjustable Lumbar","value":"power adjustable lumbar support"},{"name":"Number Of Driver Seat Power Adjustments","value":"6"},{"name":"Heated Driver Seat","value":"multi-level heating"}]},{"id":"20072640563","name":"Security","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Engine Immobilizer","value":"engine immobilizer"},{"name":"Power Door Locks","value":"hands-free entry"},{"name":"Anti Theft Alarm System","value":"remote anti-theft alarm system"}]},{"id":"20072640565","name":"Airbags","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Head Airbags","value":"front and rear"},{"name":"Passenger Airbag Deactivation","value":"occupant sensing deactivation"},{"name":"Side Curtain Airbag Rollover Sensor","value":"side-curtain airbag rollover sensor"},{"name":"Side Airbags","value":"dual front"}]},{"id":"20072640566","name":"2nd Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Folding 2nd Row","value":"split folding"},{"name":"2nd Row Seat Type","value":"bench"},{"name":"Adjustable 2nd Row Headrests","value":"height adjustable headrests"},{"name":"Number Of 2nd Row Headrests","value":"3"},{"name":"2nd Row Center Armrest","value":"folding"}]}],"equipmentCount":31}
What I'd like to accomplish is to get the value of any 'name' key in the map I've created, but I can't figure out the right way to do it (first time I've tried anything like this).  Ideally I'd like to only pull in the 'name' values that also match to an 'availability' of Standard, but I'll settle for just getting all the names and trying to filter them from there.  I know what I have currently is obviously wrong as I'm only ending up with 2 items in my features list when I run it, when it should be more like 31, but that configuration was the only way I was able to pull anything close to what I'm looking for.  Any help would be greatly appreciated as I've been banging my head against this longer than I'd care to admit today.

Thanks
Hi,

I have a apex class where i am not able to cover the following method for which i need help on it


Kindly help me how to cover this method
 
public static list<OpportunityLineItem> OppLnItm(list<Products> lstProd){
        ECom_Product_Master__c eCommPrdMas;        
        list<OpportunityLineItem>lstOppLnItem = new list<OpportunityLineItem>();        
        set<string> eCommProdId = new set<string>(); 
        set<string>PrdDeg = new set<string>();
        map<string,string>PriceBookMap = new map<string,string>();
        map<string,Products>ProdMap = new map<string,Products>();
        map<string,string> PrDesgMap = new map<string,string>();
        list<PricebookEntry>lstPriceBookId = new list<PricebookEntry>();
        list<Product_Designator__c> lstProdDesg = new list<Product_Designator__c>();
        string ProdDesg,ProdId;
        if(lstProd.size()>0){
            for(Products Pr : lstProd){
                decimal SiteCnt = 0, Booking = 0;
                eCommPrdMas = ECom_Product_Master__c.getValues(Pr.ECOM_PRODUCT_ID);
                if(eCommPrdMas != null){
                    ProdId = eCommPrdMas.Product_Code__c;
                    ProdDesg = eCommPrdMas.Designator__c;
                }
                else{
                    system.debug('No Products====>'+lstOppLnItem);
                    return lstOppLnItem;
                }
                Products tempProd = new Products();
                if(ProdMap.get(ProdId)!=null){
                    tempProd = ProdMap.get(ProdId);
                    Booking = decimal.valueOf(tempProd.BOOKING)+decimal.valueOf(Pr.BOOKING);
                    tempProd.BOOKING = string.valueOf(Booking);
                    SiteCnt = decimal.valueOf(tempProd.SITE_COUNT)+decimal.valueOf(Pr.SITE_COUNT);
                    tempProd.SITE_COUNT = string.valueOf(SiteCnt);
                    ProdMap.put(ProdId, tempProd);
                }
                else{
                    tempProd = Pr;
                    ProdMap.put(ProdId, tempProd);                    
                }                
                eCommProdId.add(ProdId);
                PrdDeg.add(ProdDesg);
                PrDesgMap.put(ProdDesg, ProdId);
            }
            if(eCommProdId.size()>0){
                lstPriceBookId = [SELECT Id, Product2.Product_ID__c FROM PricebookEntry 
                                  where Pricebook2Id in (SELECT Id FROM Pricebook2 where name = 'Wireline Price Book') 
                                  and Product2Id in (SELECT Id FROM Product2 where Product_ID__c =:eCommProdId)];
                system.debug('lstPriceBookId===>'+lstPriceBookId);
                if(lstPriceBookId.size()>0){
                    lstProdDesg = [select Id, Name from Product_Designator__c where Name =:PrdDeg];
                    for(PricebookEntry PrBkEn: lstPriceBookId){
                        PriceBookMap.put(PrBkEn.Product2.Product_ID__c,PrBkEn.Id);
                    }
                    for(Product_Designator__c prDe :lstProdDesg){
                        if(PrDesgMap.size()>0){
                            string PId;
                            PId = PrDesgMap.get(prDe.Name);
                            PrDesgMap.put(PId, prDe.Id);
                        }
                    }
                    for(string PrdId :eCommProdId){
                        Products prlist = new Products();                        
                        OpportunityLineItem OpptyLnIt = new OpportunityLineItem();
                        OpptyLnIt.PricebookEntryId = PriceBookMap.get(PrdId);
                        prlist = ProdMap.get(PrdId);
                        OpptyLnIt.Booking__c = decimal.valueOf(prlist.BOOKING);
                        OpptyLnIt.Site_Count__c = decimal.valueOf(prlist.SITE_COUNT);
                        if(PrDesgMap.get(PrdId)!=null){
                            OpptyLnIt.Product_Designator__c = PrDesgMap.get(PrdId);  
                        }                       
                        lstOppLnItem.add(OpptyLnIt);
                    }
                }          
            }
        }
        system.debug('lstOppLnItem====>'+lstOppLnItem);
        return lstOppLnItem;        
    }

Thanks in Advance
Hi All,

I have created a new Lookup field on standard Prdoduct object which points to one of my custom objects. Field has been created successfully but when I'm trying to set  a value by clicking the magnifying glass the popup doesn't show any records of my Custom object. 
As suggested in some other posts I checked for Search settings in Setup > Customize > Search > Search Settings. Custom objects has been enabled for enhance search at there. Can anyone help me to figure out what is going on please?

Thanks,
Madhura

Hi ,

We have published a app on AppExchange recently. We created a test org and attached it to Test Drive.

but problem is when someone tries to do test drive, it asks for Activation link. This problem seems to be

related with IP restriction. as I added a IP of friend who is on other network and I enable IP access for him

He could Test drive it without being asked for activation link. 

 

Now my question is how to disable IP restriction on Test drive org? as people are trying our app, and they are being asked for Activation link for Test Drive. also its not possible to define IP ranges for all the IPs?

 

 

regards

Sandip 

 

I have a VF page for creating a new support Case. The page presents a list of valid Assets, once the user has chosen a Contact. Here's the VF

 

 

<apex:inputField value="{!theCase.ContactId}" id="the_contact"> <apex:actionSupport event="onchange" action="{!contactChangedAction}" status="updating_assets_status" rerender="assets, the_asset, asset_message" immediate="false"/> </apex:inputField>

 

 

 

If the user types or pastes in a valid Contact name, the apex contactChangedAction() method is invoked. But if the user presses the magnifying glass, contactChangedAction() is not invoked. How can I make sure that contactChangedAction() is invoked, by whatever means the user changes the contact?