Skip to main content

Hi,


I have a custom object ‘Site__c’ with locations I want to retrieve all the products in other Site__c’s where they are less than 1 km of the Site.


So I have made this conditions



1: I dont want the products of $this.Site__c

2: the site parent of the products is in 1 km

3: only firm quotes.



this is the detail of the Distance filter.


SiteInformation model is the Master/main model in the page. the page shows the information of a Site.


But when I try this, in a site in Germany the ‘in less than 1 km firm quotes’ pops sites from peru, ecuador, brazil…


After playing with the model definition and discarding that as a problem, playing with the console I have discover that the distance condition is not in the SOQL of the model…:


skuid.model.getModel('QuotesNear').soql; 
"SELECT Stage\_\_c,Product\_Name\_\_c,OSI\_ID\_\_c,Base\_Currency\_\_c,Total\_Install\_Charges\_BC\_\_c,Total\_Monthly\_Charges\_BC\_\_c,Site\_\_c,Site\_\_r.Name,isOrder\_\_c,Site\_\_r.GpsCoords\_\_c,Site\_\_r.GpsCoords\_\_Latitude\_\_s,Site\_\_r.GpsCoords\_\_Longitude\_\_s,Id FROM Opportunity\_Sales\_Item\_\_c WHERE (Site\_\_c != 'a0Fb000000Eq6J3EAJ')AND(Stage\_\_c = 'Available and firm quote') LIMIT 11"

So my question is… Why?

Check the following about the SiteInformation model:

1. It must come before the QuotesNear Model in your list of Models in the Page Composer. If it is not, drag it up above.
2. Make sure that the GpsCoords__Latitude__s and GpsCoords__Longitude__s fields are in your SiteInformation Model.


Yes, I have checked that, everything is OK:


siteInformation has the fields in the model


SiteInformation is the first model, QuotesNear the last one:


It was ok since the begining so that’s not why.


no ideas of what is happening?


Does the logged in user have Field Level Security permissions to view all the fields in that condition? Conditions for fields the user can’t view are removed from the SOQL.


Yes, right now I’m testing it with my account. and I can see and edit the gps coords fields.

What Im thinking it’s maybe this is not working because is in other object? I mean, I’m querying Opportunity_Sales_Item__c but the condition is on Site__r.GpsCoords__c 


Pablo,


I have tried to replicate a similar scenario with standard objects and fields, and the Condition’s SOQL is being generated correctly and the query is running as expected. I am using the Account BillingAddress field and the Contact MailingAddress field, both of which are treated as Geolocations. I have 2 Models and here are the Conditions:




What Skuid version are you running?


Pablo, did you have any luck with this? I’m experiencing what appears to be the same issue. I’ve found if I use in my filter field an ADDRESS field (these are only on standard objects) that it works just fine. If I try to use the GeoLocation field though, it doesn’t work. I get the same result on the query in your example where the soql filter doesn’t show up. In other words, Account.ShippingAddress works, but CustomObject.Address_Geolocation__c does not.


I’m experiencing the same issue. The condition is not added to the SOQL query when using custom fields on a custom object.


Brayden, I found that I could utilize the REST SOQL API to get around the issue. I set up ‘external data’ using this method: http://help.skuid.com/m/models-conditions-filters/l/530859-connecting-to-external-data-in-skuid

That external data just happened to be the Salesforce REST API. 

This wasn’t the best, but it worked.


Reply