• Rudi Ornelas
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Sen. Support Analyst

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hi, Team,

I'm trying to get this formula field finalized, however, it keeps populating the shipping value no matter what the picklist selection is. So, it always default to shipping city. The logic should go if type = hospital populate ShippingCity, else, populate BillingCity
 
IF(
OR(
ISPICKVAL(Type, "Hospital"),
ISBLANK(TEXT(Type))
),
ShippingCity,
BillingCity
)

 
Hi Everyone,

I have a trigger populating an Account lookup(id) and a distance field (num) on Account record. This limits me to only one record. I would like to see the 10 nearest record. I understand I will need a custom object with a master-detail lookup to account as well as the Account lookup(id) and a distance field (num). 

How would I achieve this?
Here's the part of my code where I'm looping thru my acctList and insert. I just can't figure out how to change my code to insert detail records instead 
//Compare Distance of all Index and store nearest one in Intialized variable.
	for(Integer i = 0; i < accList.size(); i++ ){
Double Distance = ds.getDistanceAtIndex(i);
Double Traveltime = ds.getTravelTimeAtIndex(i);
List<double> distances = ds.getListOfDistances();


    if(i == 0){
        NearestDistance = Distance;
        String_AccountId = accList.get(i).Id;
        NearestTravelTime = 0;
       
    }
        If(i == 1){
        if(NearestDistance > Distance){
        NearestDistance = Distance;
        String_AccountId = accList.get(i).Id;
        NearestTravelTime = Traveltime;
    }
            
    }
    
} 
    
    
     
//add final distance, Account Id and Drive time to newly inserted Account recod.
objAccount.Distance__c = NearestDistance;
objAccount.NearestAccount__c = String_AccountId;
objAccount.TravelTime__c = NearestTravelTime;
    
Update objAccount;

    }
}​

 
Does anybody know of a better way of accessing apps in Lightning?
Created short video
http://screencast.com/t/7vB2Mxf4jz
 
In Salesforce clasic it was one click to get to my app. Now it takes me about 3 clicks to get to my Geopointe App. Any help and/or best practices would be greatly appreciated!
Hi, Team,

I'm trying to get this formula field finalized, however, it keeps populating the shipping value no matter what the picklist selection is. So, it always default to shipping city. The logic should go if type = hospital populate ShippingCity, else, populate BillingCity
 
IF(
OR(
ISPICKVAL(Type, "Hospital"),
ISBLANK(TEXT(Type))
),
ShippingCity,
BillingCity
)