7

With Field Service Lightning, a Location object was added. When we try to work with this object it's always saying that we are referencing the System.Location object. How can I reference the Location object from FSL in Apex?

2 Answers 2

11

You need to explicitly reference the field service Location object as Schema.Location since just saying Location implicitly refers to the older System.Location class.

1
  • Thanks for this answer. I was stumped on the same thing and was just about to post a new question. Commented Jul 18, 2017 at 18:01
5

You can access FSL Location by using Schema.Location. This worked for me:

for(Schema.Location loc : [SELECT Id,Name FROM Location]) {
    System.debug(loc.Name);     
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .