Salesforce SOQL Fields(ALL) does not exist - salesforce

I am getting a very strange error today on a Salesforce instance with this SOQL query. This works in my other Salesforce instances but not this one.
select FIELDS(ALL) from Contact where Id = '003Dp000001i1X8IAI'
The error from Salesforce:
select FIELDS(ALL) from Contact where Id = '003Dp000001i1X8IAI'
^
ERROR at Row:1:Column:15
Invalid field: 'ALL'
Any idea why this wouldn't be working in this particular Salesforce instance?

Related

Query not running properly

I ran a query using google big query but I get an error as a result. I don't know what could be wrong.
SELECT
usertype,
CONCAT(start_station_name, " to ", end_station_name) AS route,
COUNT(*) as num_trips,
ROUND(AVG(CAST(tripduration AS INT64)/60),2) AS duration
FROM
`bigquery-public-data.new_york_citibike.citibike_stations`
GROUP BY
start_station_name, end_station_name, usertype
ORDER BY
num_trips DESC
LIMIT 10
You must be getting this error: Unrecognized name: usertype . As the error suggests bigquery-public-data.new_york_citibike.citibike_stations dataset doesn't have any column usertype.
As #samuel mentioned, usertype column is present in new_york_citibike.citibike_trips. Do cross check your dataset before querying.

Why do I get the Error Message: "No modifications to the 'SYSTEM' or 'INTEGRATION' user are permitted.", when I add an Optional default Value?

I'm migrating some Database from SSMS to CRM Online. And the problem is, that there are systemuser in SSMS Database, which were deleted in CRM Online, or worse the systemuser has a new GUID. In this case I tried to look for similarities. I found out, that the systemusers from both System have the same value in the field "internalemailaddress". So I used it in my Dynamics CRM Destination. And added an value for the "optional default value".
And this Error code came out:
CRM service call returned an error: No modifications to the 'SYSTEM' or 'INTEGRATION' user are permitted.
On the other site, I could use the fullname, which I did with an "optional default value".
And this gave me this Error code:
CRM service call returned an error: systemuser With Id = 11111-111-AAAA-BBBB-123456789 Does Not Exist
and
CRM service call returned an error: An unexpected error occurred.
And when I don't write anything in the "Optional default value" I get this Error message: KingswaySoft.IntegrationToolkit.DynamicsCrm.LookupFailureException: Text lookup failed for 'managerid' field, entity 'systemuser' does not contain a record that has a value of '' for 'fullname' field (SSIS Integration Toolkit for Microsoft Dynamics 365, v11.1.0.7311 - DtsDebugHost, v15.0.2000.93)
Does someone know the problem and the solution?
I would be really grateful.
My first mistake was, that I tried to give the GUID in the "internalEmailAddress". To solve it, I did an LEFT JOIN where I get all Territory's and their SystemUsers.
My SQL Query:
SELECT Territory.*, ModifiedBy.InternalEMailAddress as M_EMail,
CreatedBy.InternalEMailAddress as C_EMail, ManagerId.InternalEMailAddress as Manager_Email
FROM TerritoryBase as Territory
LEFT JOIN SystemUser as ModifiedBy
ON Territory.ManagerId = ModifiedBy.SystemUserId
LEFT JOIN SystemUser as CreatedBy
ON Territory.CreatedBy = CreatedBy.SystemUserId
LEFT JOIN SystemUser as ManagerId
ON Territory.ManagerId = ManagerId.SystemUserId
Then in the Destination I assigned the columns like:
Source Destination
C_Email CreatedBy
M_Email ModifiedBy
Manager_Email ManagerId
And the Text Lookup Editor is like:
InternalEmailAddress(E-Mail from SystemUser)
This solved the problem, but I still got this error:
CRM service call returned an error: No modifications to the 'SYSTEM' or 'INTEGRATION' user are permitted.
The problem for this Errorcode was, that I had multiple SystemUser in Territory in the field "ManagerId", that didn't exist in the Online CRM. And since I put a "default option value", all the missing SystemUsers were assigned to 1 SystemUser. And in CRM you cannot assign 1 SystemUser to more Territory's ManagerId's field. So the end result was to not fill the field, if the user didn't exist.
But if you need to assign SystemUser's to the ManagerId field, then you should assign the SystemUsers manually with a "Derived Column".

How to use inner query to fetch data from salesforce to mule?

I wrote below query to fetch data from salesforce but getting error like "Unknown error parsing query"
select Email,Id from contact where Email in (select b.Email from contact as b group by b.Email having count(b.id) < 2 limit 1000)
inner query alone retrieving the set of mail Ids, please suggest.
Are you sure the issue is not related with the query / organisation ?
Using SOQL workbench --> https://workbench.developerforce.com
and getting this error:
MALFORMED_QUERY:
(select b.Email from contact as b group by b.Email having count(b.id)
^
ERROR at Row:1:Column:78
expecting a right parentheses, found 'group'
You can first check your query on Salesforce using developer console if its working or not.
If its returning required result in Salesforce then it will work in Mulesoft as well.

Can't select User ID from Salesforce

I'm trying to select user's subordinates from Salesforce, but a simple query
SELECT Id FROM User WHERE ManagerId=xxxxxxxxx
returns bunch of null values, when I run
SELECT Id,Name FROM User WHERE ManagerId=xxxxxxxx
I get the correct names, still no IDs.
Is this a permission issue? I can't find anything when I login to portal.
I'm running the queries via API on Sandbox environment.
Try this (both works for me allways):
Id myId = [Select Id From User Where Username = 'myUserName'].Id;
System.debug('#### myId: ' + myId);
List<User> myIdList = [Select Id From User Where Username = 'myUserName' Limit 1];
System.debug('#### myId from list: ' + myIdList[0].Id);
Portal Licence doesn't allow to query User. However you have still access to the name of the user through OwnerId, CreatedById, LastModifiedById using in an inputfield.
i.e :
If you want to have access to user through the portal you need a custom object and synchronise your records with User by trigger.

How to set Id field and query it in GAE datestore via JPA

I want to set the Id field with type of Long. However, when I query it, I got this exeception:
Cannot access field id on type
and this is my annotation for this query
#NamedQuery(name = Q.User.FindById, query = "SELECT u FROM User u WHERE u.id = :id") })
Stacktrace:
org.datanucleus.exceptions.NucleusUserException: Cannot access field id on type com.j.model.User
at org.datanucleus.query.compiler.JavaQueryCompiler.getType(JavaQueryCompiler.java:552)
at org.datanucleus.query.compiler.JavaQueryCompiler.getType(JavaQueryCompiler.java:529)
at org.datanucleus.query.symbol.SymbolTable.getType(SymbolTable.java:118)
at org.datanucleus.query.expression.PrimaryExpression.bind(PrimaryExpression.java:118)
at org.datanucleus.query.expression.DyadicExpression.bind(DyadicExpression.java:85)
at org.datanucleus.query.compiler.JavaQueryCompiler.compileFilter(JavaQueryCompiler.java:299)
at org.datanucleus.query.compiler.JPQLCompiler.compile(JPQLCompiler.java:75)
at org.datanucleus.store.query.AbstractJPQLQuery.compileInternal(AbstractJPQLQuery.java:246)
at org.datanucleus.store.query.Query.setImplicitParameter(Query.java:690)
at org.datanucleus.jpa.JPAQuery.setParameter(JPAQuery.java:428)
I have been digging around for this, some suggest to do with Key and getname. quiote confuse, how can I solve it?
Thanks.

Resources