New answers tagged

1 vote
Accepted

Correlated Not In Subquery

No, correlated subqueries are not supported. But in Apex you can use the same variable with the case identifier in both queries: SELECT Id FROM Task WHERE Type = 'Case' AND WhatId = :caseId AND ...
Renato Oliveira's user avatar
2 votes
Accepted

SOQL Lib how to test a sub query

To test sub-queries you should use the deserialization mechanism with JSON data (to write on non-writable fields), as described in the documentation: Sub-Query To mock a sub-query we need to use ...
Renato Oliveira's user avatar
0 votes

Getting Distinct Values in SOQL Query

Query the latest StageName from the Opportunity object to use the OpportunityFieldHistory object, which tracks the history of changes for the StageName field. You can use a SOQL query that filters by ...
Tushar Jadav's user avatar
2 votes
Accepted

Executing SOQL with User Mode and then DML with user Mode causing Exception

My_Rule__c appears to be a master-detail relationship field with reparenting disabled. For some reason, supplying the same value as what is already in the field still causes this error, because the ...
sfdcfox's user avatar
  • 481k
1 vote
Accepted

How to deactivate all flows via sf cli

ah I found appropriate syntax sf data update record --json --use-tooling-api --target-org $targetOrgAlias --sobject FlowDefinition --record-id $flowId --values "Metadata='{\"...
vctqs1's user avatar
  • 55
1 vote

Dynamic SOQL Error: Unexpected Token ':' - I have searched for two days, what could I be missing?

You can use String join to fix the issue. String selectList = String.join(fields,','); String soqlQuery = 'SELECT ' + selectList + ' the rest of the query... ';
Ken's user avatar
  • 176
0 votes

Using SOQL to pull records where conditions can be AND but also OR

I'll simplify your query to be clearer. I used A, B, C and D to differentiate your criterias. SELECT MY_FIELDS from MY_OBJECT WHERE (A AND B) OR (C AND D) Now, assuming that this query can not ...
Oueslati Bechir's user avatar
0 votes

Using SOQL to pull records where conditions can be AND but also OR

I'd hard code two queries: one with the OR and one with the AND. Alternatively you could only execute the OR one and check if the AND condition is true as you loop over the OR results using Apex logic....
Keith C's user avatar
  • 135k
1 vote
Accepted

SOQL Count Distinct Accounts based on MIN Approved Date

You are correct that SOQL does not support subqueries in the FROM clause, unlike SQL. However, you can still achieve your desired result by using a different approach. You can use an aggregate query ...
Tushar Jadav's user avatar
0 votes

PicklistValueInfo does not returns Custom object's picklist records but only returns standard object's picklist records

Or in one step... SELECT Value,Label,IsActive FROM PicklistValueInfo WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'Client_Master__c' AND EntityParticle.QualifiedApiName = 'Status__c'
Ciarán's user avatar
  • 101
0 votes

SOQL Nulls Last with Orderby Picklist field doesn't work

You can try creating a text type formula field, with the name PriorityText__c like this: TEXT(Priority__c) Then you change your Query for this: SELECT Id, ContactId, LeadId, Status, Priority_c, ...
Juan Luis Ruiz Bautista's user avatar

Top 50 recent answers are included