Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [query]

A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user's request.

Filter by
Sorted by
Tagged with
1 vote
1 answer
25 views

How to fetch name field for a record of given record id but known object?

I am trying to obtain all related child (look up) records of a record whose record id is passed. Salesforce docs say that for every object, regardless of type, name is a standard field, just like Id. ...
user avatar
0 votes
1 answer
17 views

Database.query() question

Is it ok to use String.escapeSingleQuotes() inside of a database.query() or do you need to create a new variable using the String.escapeSingleQuotes() first and then use the new variable in the ...
user avatar
-1 votes
1 answer
29 views

SQL query where my child dates should be greater than 3 years from the current date [closed]

I have three date columns My child Date and I want those records in which MyDate should be greater than current date by 3 years. Based on child dob year how can i get the below 3 years records only ...
user avatar
  • 345
-1 votes
1 answer
30 views

SOQL queries Where Clause given Error UNEXPECTED Token

[ SELECT Name, (SELECT Communication_Type__c, Communication_Mode__c, Additional_Information__c, CBProgramInformation__r, Reporting_Type__c FROM Reporting_Detail__c ) FROM ...
user avatar
-2 votes
1 answer
99 views

To avoid SOQl query inside for loop

I have the below code and there is a SOQL query inside for loop. I have been instructed to avoid SOQL in the loop as these are invoked for every iteration of the loop. Since i am a beginner in ...
user avatar
-2 votes
0 answers
21 views

"Root entity queries"....could anyone clarify my doubts [closed]

more than 1 level away from the root entity object. Try to find it when we will get this error and write a error query...can any one explain
user avatar
  • 1
-2 votes
1 answer
37 views

Method does not exist or incorrect signature: void getOppty(Id) from the type classname (108:19)

I want to do a refactor from this map, so I try with a method, this is how I try: private static Map<Id,Opportunity> getOppty (Set<Id> solutionId) { Map<Id, Opportunity> oppties = ...
user avatar
  • 3
0 votes
1 answer
23 views

How to obtain child records for a given parent record and vice versa?

I want to create an Apex function that takes a recordId of unknown entity type, identifies the entity type and subsequently returns all child records (name, id) of the given record. In addition, the ...
user avatar
0 votes
1 answer
17 views

Tracking number of contact attempts based on Tasks under Contact

I need to update a custom field called Contact Attempts on the Contact sobject with a numerical value equal to the number of all Tasks associated with the Contact. Any time a Task is added or deleted, ...
user avatar
  • 5
-3 votes
1 answer
31 views

An error occurred while checking the query syntax. Errors: Incorrect syntax near ')' [closed]

Hello i want to count with condition but i got syntax error , i don't where the issue is this is my query : SELECT Statut__pc as 'Statut', Count(CASE OptinInvitationsVente__pc when 'true' THEN 1 ELSE ...
user avatar
0 votes
0 answers
25 views

Flow runs into SOQL limit

I need to know when something was changed in connection with contacts like events, tasks, contracts, campaign... I query each object for the newest date to store it in a collection and at the end I ...
user avatar
  • 83
0 votes
0 answers
28 views

How can I add a query activity on a running automation to start a new journey?

I am new at Marketing Cloud, so I am sorry if this is a silly question but I could use some help. I have an automation running with a query activity to combine different objects and populate a Data ...
user avatar
0 votes
1 answer
18 views

removing duplicates from a database.query based off a single field within that record

Here's the query: Merchandise__c[] merchList = Database.query('SELECT ' + lookupFieldApiName +'.Id, '+ lookupFieldApiName +'.Name ' + '...
user avatar
  • 464
0 votes
1 answer
30 views

Sql query to exclude related records in dataset

I am attempting to create an sql query in salesforce marketing cloud...I have a list of email addresses, the number of products they own, and the associated product codes. I would like to set up the ...
user avatar
0 votes
1 answer
46 views

How to Query Child records of the lookup record in a single query

I have 3 custom objects Organization__c School__c Student__c The objects are related like below: Object Organization__c has a lookup field School__c which is a lookup on the object School__c. ...
user avatar
  • 113
-1 votes
1 answer
23 views

Order Query Results aside from ASC and DESC

I have a query that returns the following results: Apple Banana Grape Pomelo Is there a way to make the "Grape" appear on top of the results? Adding a new field to be used as an ordering ...
user avatar
  • 103
0 votes
2 answers
26 views

how to write a query to filter the multiple input field of account

public with sharing class SearchComponent{ @AuraEnabled(cacheable=true) public static List<Account> getAccountList(String searchKey) { String key = '%' + searchKey + '%'; return [...
user avatar
1 vote
1 answer
46 views

Logic problem, it is possible? Add more quotelineitems if it has more than 1 on quantity

Hello Guys. My method does not work correctly. What it does is call another method inside a loop, the functionality is to take each quotelineitem from the quote until it finishes collecting all the ...
user avatar
0 votes
0 answers
18 views

Add quotelineitem depending of quantity

Hello Guys. My method does not work correctly. What it does is call another method inside a loop, the functionality is to take each quotelineitem from the quote until it finishes collecting all the ...
user avatar
0 votes
2 answers
58 views

How to query related Contact from Account by Id in "after insert, before update" trigger?

I need to query the related Contact after a new Account is inserted and before it is updated, but I am encountering an error: System.QueryException: List has no rows for assignment to SObject. I've ...
user avatar
  • 5
0 votes
1 answer
30 views

Create list with two queries

i have this query: Set<Id> drIds = new Set<Id>(); List<custom_Object__c> dr = [SELECT id, name FROM custom_Object__c WHERE AcountId__c =: accountId]; for(custom_Object__c drl :dr) { ...
user avatar
0 votes
0 answers
55 views

Error too many rows 50001 in a custom Rest API

I have a custom rest API that when is called from a third party system (this third party system calls me providing a country code like UK, DE, US... and some other parameters) I filter account object ...
user avatar
  • 1
0 votes
0 answers
56 views

how to find out total number of subscribers who were sent 1 email in last from in salesforce marketing cloud

I am trying to get a count of all subscribers (irrespective of BU) - hence I am running the query in parent BU who received ONLY 1 email in previous month. This is my query but it is not returning any ...
user avatar
  • 99
0 votes
1 answer
19 views

I am getting FATAL_ERROR System.QueryException: unexpected token: BM_DPM_Date__c

I am facing the following issue. I wrote this query for the start method of my batch class. global Date startDate; global Date endDate; global Date currentDate; global Database.QueryLocator start(...
user avatar
  • 25
0 votes
1 answer
64 views

Query to Combine Data from 3 different Data View Tables

I've pulled the last 30 days of data from 3 data view tables (Job, Open, and Click) into 3 different data extensions. I'm attempting to run a query to dump data from my 3 different data extensions ...
user avatar
0 votes
1 answer
46 views

_Open.IsUnique is TRUE for two records with the same JobId and SubscriberKey - Why?

From my understanding, the first "open" that's recorded for a particular JobId will have their IsUnique attribute as TRUE. Any subsequent opens AFTER that will still be recorded, but with ...
user avatar
1 vote
2 answers
63 views

Query Studio SQL statement to pull data date range function syntax

I'm using Query Studio in SFMC - Is there a better way to write this query? I checked the DE - I 99% sure there are records to see but doubting myself if I'm writing this correctly. I'm just trying ...
user avatar
  • 13
0 votes
1 answer
41 views

Escape underscore (_) in SOQL LIKE clause

Before you point me to LIKE Clause documentation, I already read it. I created new custom object thats API name is TestObject__c. Now I would like to query my custom objects. So I need to find the ...
user avatar
0 votes
1 answer
38 views

MobileConnect: Query that will show OptInStatus for all contacts

I need to see the OptInStatus for all contacts in MobileConnect. I've tried querying off of the SMSSubscriptionLog data view, but I'm not very strong with SQL. Here is the query I've been using, but ...
user avatar
0 votes
1 answer
45 views

Records duplicated on SQL Join (Marketing Cloud)

I'm trying to return the results of subscribers who have been sent emails, when they've been sent, if they've opened/clicked and whether or not is house bounced/they've unsubscribed. I'm using the ...
user avatar
-3 votes
1 answer
62 views

SOQL nested query not working

I want to save the following query but it given me errors: Query: Set<Id> extUserIdSet = new Set<Id>(); List<Object1> obj1= [ SELECT Id, ExternalId, Name, Address, ( ...
user avatar
0 votes
1 answer
33 views

Write SOQL nested query

I have two objects. Object2 has lookup relationship to Object1. I want to write a SOQL query to fetch some data of Object1 where the territory field of Object2 is equal to UK. Set<Id> ...
user avatar
1 vote
0 answers
22 views

How to reset the off set value after 2000 records

I have aura component which fetch the records And I have a Object that has 2100 records Now I have to navigate to the last record page but it is not possible because of offset limit so how to overcome ...
user avatar
0 votes
1 answer
45 views

Query not executing

select top(200) * FROM ._Click C with (nolock) INNER JOIN CLM_Sendlog S with (nolock) on S.TriggeredSendID = C.TriggererSendDefinitionObjectID where C.TriggererSendDefinitionObjectID = '7e248b8b-...
user avatar
  • 1
0 votes
1 answer
23 views

Same Bulk API Query success at local but failed after deploy to Airflow

I have tried all the ways to debug the code, also check the library version between my local machine and server, they are same. Following is the query success at local: sfdc query: SELECT Id,OwnerId,...
user avatar
0 votes
1 answer
89 views

Count the number of contacts in each Business Unit

I have 2 BUs in the Marketing Cloud and each has its own contacts. My issue is that I want to retrieve the number of contacts in each BUs (no need to be exact, just an appropriate number would be ...
user avatar
0 votes
0 answers
23 views

Split throught % of Open Rate

I have a journey where I send a 1st email and after that email I have to evaluate the opening % of that 1st email. In one way I will send another email to everyone who has an open rate > 20% and ...
user avatar
  • 1
-2 votes
1 answer
139 views

Get for each parent record all child records of a specific object type in a map<parentid, list<childobject>> [closed]

I'm trying to figure out the correct approach to get for each parent record in a list : all the specific sobject child records related to that specific parent record. And I would like to arrange them ...
user avatar
  • 1
0 votes
1 answer
92 views

SQL Query Timeout Help SFMC

I have the following query that is consistently timing out for the last few weeks. It had ran perfectly fine since 2019, previously. I know the query needs to be optimized, but I don't see anything ...
user avatar
0 votes
1 answer
125 views

SQL query to update field only if it is empty

I need to run a query which updates a target DE with some rows from another. There is a field called 'origin' which shows on the target data extension where the data came from. I appreciate this may ...
user avatar
  • 792
0 votes
0 answers
62 views

What should be used to search a string across multiple fields of a single object? SOQL or SOSL

I want to search records for a particular object based on filter string that can match multiple fields on that object. This can be achieved via both SOQL and SOSL: SOQL : using like operator, applying ...
user avatar
  • 2,450
0 votes
0 answers
29 views

conn.query() method is not returning all the records

I am trying to create a custom sfdx plugin, for that I am fetching a query result using const result = await connection.query(SOQLQuery); but it is not giving me all the records which are present in ...
user avatar
0 votes
1 answer
46 views

How to list all record ids if "SELECT Id FROM ObjectName" returns fails with QUERY_TIMEOUT?

I need literally all the records. Documentation says that if I hit 120 sec. limit then I should refactor my query to retrieve less amount of data. The only option not to skip data but collect it part ...
user avatar
0 votes
1 answer
51 views

SQL, retrieve one line with Max rule

I want to be able to have in the Data extension the information of the opportunity, the account, the opportunity product and the product information. I need to establish a rule to select the ...
user avatar
1 vote
2 answers
162 views

Is possible to retrieve all records on a single query?

I am using this library (forrest) to make queries in the salesforce REST API, when I do the query, it seems that salesforce returns me a pagination, I have verified it with postman as well. for ...
user avatar
4 votes
1 answer
83 views

Subqueries in soql for loop vs standard soql queries

I have 26 accounts and 24 contact records in the org and running a SOQL query on them (fetching Accounts along with contacts). Found that if SOQL for loop is used then the child records fetched in the ...
user avatar
  • 193
1 vote
1 answer
102 views

How to replace a SOQL query with a string?

Any idea how to convert a query into a string?
user avatar
0 votes
2 answers
65 views

Need help moving SOQL out of the loop

Hello, I need move this query out of loop: List<Lead> dupeLeads = [SELECT Id, Email FROM Lead WHERE Id != :Ld.Id AND Email =: Ld.Email]; I'm testing various guides on "bulkifying ", ...
user avatar
1 vote
1 answer
93 views

Identify automation populating a Data Extension

I need to know which Automation is filling in a Data Extension (DE), the only way I know is to open the Automation one by one and see if it fills in my DE. Is there a faster way to search for it? Are ...
user avatar
  • 11
0 votes
1 answer
26 views

Parent-Child relationship query

Given Account - MaintenancePlan relationship, I have this SOQL: SELECT Id, (SELECT id from MaintenancePlans WHERE Id = 'xxxxxxxxpUGAS') FROM Account Problem is that I just need to get the ...
user avatar
  • 157

1
2 3 4 5
32