VisualForce Controller SOQL query prematurely limited - salesforce

I have a visual force page that references my controlling class 'ESWebCaseController.cls'.
The visual force page has a field called 'Company' that runs on an SF site and is accessible by anyone when the form is submitted is used in a SOQL query like:
List account_list = [SELECT Name FROM Account WHERE Name =:company];
This query returns 0 results when company = Acme, however this same query returns 1 result when done using the Eclipse IDE SF Schema. There is defnately a company named Acme in my org.
When I remove the WHERE clause in the query, 10 Accounts are returnted, even if I set LIMIT 100, only 10 accounts are returned. These 10 accounts seem to have one thing in common and that is that they reference the same parent account and/or have a specific field ID that references the parent account.
I want to know if there is anything that would cause the above query in my controlling class to be limited outside of the Query itself.
Below are the debug logs for the Query:
20:28:32.158 (158986000)|POP_TRACE_FLAGS|[163]|01p500000009goT|ESWebCaseController|APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINEST;VALIDATION,FINEST;VISUALFORCE,FINEST;WORKFLOW,FINEST
20:28:32.159 (159879000)|SOQL_EXECUTE_BEGIN|[163]|Aggregations:0|select Name from Account where Name = :tmpVar1
20:28:32.159 (159893000)|LIMIT_USAGE|[163]|SOQL|1|100
20:28:32.159 (159898000)|LIMIT_USAGE|[163]|AGGS|0|300
20:28:32.177 (177286000)|SOQL_EXECUTE_END|[163]|Rows:0
20:28:32.177 (177308000)|LIMIT_USAGE|[163]|SOQL_ROWS|0|50000
20:28:32.177 (177324000)|HEAP_ALLOCATE|[163]|Bytes:4
20:28:32.177 (177337000)|HEAP_ALLOCATE|[163]|Bytes:0
20:28:32.177 (177411000)|HEAP_ALLOCATE|[163]|Bytes:4
20:28:32.177 (177441000)|VARIABLE_SCOPE_BEGIN|[163]|account_list|LIST<Account>|true|false
20:28:32.177 (177488000)|VARIABLE_ASSIGNMENT|[163]|account_list|{"serId":1,"value":[]}|0x14cace14
20:28:32.177 (177504000)|STATEMENT_EXECUTE|[165]

Are you using with Sharing on your controller and do you have access to the account Acme from the user running the query?
By default classes have "with sharing" so they respect the sharing in the parent org, this means that if the user who accesses the page does not have access to the data the data will not be available for the query.
A quick and easy test for this is to get the Id of the record you need access to and log into salesforce then go to the url directly.
So if the record was a01adf20123032 (that's a made up id fyi) and your instance was na1 you'd log into salesforce and navigate to https://na1.salesforce.com/a01adf20123032 if you get insufficient privileges then the person doesn't have access.
Through the IDE you're most likely using a system administrator user with the "view all data" permission so they'll always get all data returned.

Related

Error retrieving query using ccrz.cc_CallContext ERROR Returned tmpVar1 Salesforce APEX

Having troubles figuring out why the query isn't returning the related Account for the Cart object. The original query was referencing the cart Encrypted ID and the current user Encrypted ID to query the related account for the cart. We have contacts with multiple Accounts and the Default Account keeps being referenced in the query rather than the current user account information.
-Query Used
ccrz__E_Cart__c cart = [SELECT ID,ccrz__Account__r.Name, ccrz__Account__r.Id , ccrz__TotalAmount__c, ccrz__EncryptedId__c FROM ccrz__E_Cart__c WHERE ccrz__Account__r.Id =: currentAccount LIMIT 1];
-Returned Value
SELECT ID, ccrz__Account__r.Name, ccrz__Account__r.Id, ccrz__TotalAmount__c, ccrz__EncryptedId__c FROM ccrz__E_Cart__c WHERE ccrz__Account__r.Id = :tmpVar1 LIMIT 1
-ERRORS RETURNED
CUMULATIVE_PROFILING|No profiling information for SOQL operations
CUMULATIVE_PROFILING|No profiling information for SOSL operations
CUMULATIVE_PROFILING|No profiling information for DML operations
CUMULATIVE_PROFILING|No profiling information for method invocations

Query users with a filter and expand results in unsupported query

I am trying to fetch a list of users from the Microsoft Graph API.
A lot of users don't have an email address, those users are systems users that I don't need.
So my query looks like /users?$filter=mail ne null
For another overview I need to show the manager of each user so I tried to add &$expand=manager. But doing so will result in an Unsupported Query.
When I remove the filter parameter it does work.
How can I only fetch relevant users and their managers in a single query?
Optionally I'd like to only receive the ID from managers, as an optimization. I only need the ID because I already fetched all users and their data. /users?$expand=manager($select=id) is what I was trying but I get the error Invalid $select properties.
If you want to use $select inside $expand to select the individual manager's properties, the $levels parameter is required, such as expand=manager($levels=max;$select=id). For more details, please refer to here
For example
https://graph.microsoft.com/v1.0/users?$expand=manager($levels=max;$select=id)
Update
If we want to use Not equals (ne) operators on the $filter query parameter, we must set the ConsistencyLevel header set to eventual and, with the exception of $search, use the $count query parameter (either as a URL segment or $count=true query string). For more details, please refer to here
For example
https://graph.microsoft.com/v1.0/users?$filter=mail ne null&&$expand=manager($levels=1;$select=id)&$count=true

XPath problem - Retrieving user by name (Mendix)

I have Tasks entity, associated with Administration.Account entity (I use it to display a list of tasks with assigned users).
Tasks entity has a string parameter “Requester”, where I store names of users.
I created a microflow, which should retrieve an account of the user from the database, comparing his name with the name in the “Requester” parameter.
[Name = $Tasks.Requester]
The problem is, that I’m getting XPath error, and when I’m typing $Tasks. all available parameters belong to the Account entity, instead of the Tasks entity.
You must use slash (/) when constructing your XPath. So this should work in your case:
[Name = $Tasks/Requester]

Can I create a new global security group with an existing name in Active Directory?

How can I create a global security group with a name of finance, seeing that I already have a user with that name in Active Directory. Is it possible?
You cannot have two objects of the same name in the same container - so you cannot create a group called Finance in the same container (OU) where the user Finance exists. Both user as well as group would be identified by
OU=Finance,OU=YourOU,OU=YourOtherOU,dc=YourCompany,dc=com
and that won't work - the fully distinguished bane (FQDN) of each object must be unique.
Other than that, there's a requirement that objects must have unique SAM Account Names - which by default are the same as the "display" name (Finance) - but can be set to something else.
So if your user is called Finance and has a SAM account name of Finance - then you should be able to create a global group called Finance (in a different OU/Container) by settings it's SAM account name to e.g. FinanceGroup or something like that.
You're not specifying what language/programming system you're using - if you're trying to create this group in C# / .NET 3.5 or higher, you could use code something like this:
using(PrincipalContext ctx = new PrincipalContext(ContextType.Domain))
{
GroupPrincipal finGroup = new GroupPrincipal(ctx);
finGroup.DisplayName = "Finance";
finGroup.SamAccountName = "FinanceGroup";
finGroup.Save();
}

Salesforce Bulk api InvalidBatch : Field name not found

I am using the bulk upload code described at http://www.salesforce.com/us/developer/docs/api_asynch/.
The only difference is that i am uploading a custom object type. I can access Employee_c. But now i get a different error
stateMessage='InvalidBatch : Field name not found : First Name'
First Name is the first column in the csv.
While debugging i can see that the temp csv is being created correctly. However i get this error when checkResults executes. The code is exactly the same as in the sample java code for bulk api using REST.
I am using the free developer version of salesforce.
I created a new permission set where i have given following permissions on custom object employee:
Read/create/edit/delete/view all/modify all.
All fields are given edit permissions.
The permission set is associated with salesforce user license.
The programmatic login is with a user associated with System administrator profile , which has sales force user license.
But still the error persists!
Any pointers would be appreciated
Thanks
Sameer
Try "FirstName" without the space.
You can view the API name of any field in Setup > App Setup > Objects > (Select Your Object) > (Select Your Field). Make sure all the fields you are querying have the correct API names.

Resources