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
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.
-
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
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);
}