Geolocation 无法使简单Apex类可开票-基于坐标输入查找自定义位置记录

Geolocation 无法使简单Apex类可开票-基于坐标输入查找自定义位置记录,geolocation,salesforce,apex,flow,Geolocation,Salesforce,Apex,Flow,我有一个简单的类,其中包含一个SOQL查询,该查询根据2个坐标的输入查找最近的自定义位置记录: public with sharing class NearestLocation { @InvocableMethod(label='Get Nearest location' description='From given coordinates the nearest location is returned') public static List<custom__Location__

我有一个简单的类,其中包含一个SOQL查询,该查询根据2个坐标的输入查找最近的自定义位置记录:

public with sharing class NearestLocation {

@InvocableMethod(label='Get Nearest location' description='From given coordinates the nearest location is returned')
public static List<custom__Location__c> getLocation(List<FlowInput> requests)
{

    List<custom__Location__c> locList =
    [SELECT  id, Name
    FROM custom__Location__c  WHERE RecordType.Name = 'Synced' AND 
    DISTANCE(custom__GeoLocation__c, GEOLOCATION(:requests[0].coordlat, :requests[0].coordlng), 'km')<1
    ORDER BY DISTANCE(custom__GeoLocation__c, GEOLOCATION(:requests[0].coordlat, :requests[0].coordlng), 'km')
                     LIMIT 1];

  for(custom__Location__c lc : locList)
  {
      system.debug('~~!~~!~~' + lc.id);
      system.debug('~~!~~!~~' + lc.name);
  }
        return locList;
}

    public class FlowInput 
    {
        @InvocableVariable(required=true)
        public decimal coordlat;
        @InvocableVariable(required=true)
        public decimal coordlng;
 }   }
public,共享类位于最近位置{
@InvocableMethod(label='Get Nearest location'description='从给定坐标返回最近的位置')
公共静态列表getLocation(列表请求)
{
列表locList=
[选择id、名称]
来自自定义位置,其中RecordType.Name='Synced'和

距离(自定义地理位置、地理位置(:requests[0].coordlat,:requests[0].coordlng),“km”)如果将输出分配给集合变量,请尝试返回列表>。

已解决

代码没有继承性的错误…问题是由于闪电流中不相关的公式造成的!嗯…自我说明…从空白画布开始

感谢艾哈迈德的回复。它返回了一个列表: 公共静态列表 返回列表

list <NearestLocation.FlowInput> fi = new list<NearestLocation.FlowInput>();
NearestLocation.FlowInput x1 = new NearestLocation.FlowInput();
x1.coordlat = 53.243213;
x1.coordlng = -1.475886;
fi.add(x1);
NearestLocation.getLocation(fi);