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
2answers
34 views

Select records from a List with a specific RecordTypeId

I have a List of the object Animal, with records from two different record types, How can I return another List with the animals with one of those record types?? Preferrably using a query instead ...
3
votes
1answer
71 views

More efficient to query or to loop through a bulk return of sObjects

Kind of a vague question but I am writing some "rollup" or summary queries that in totality will collect right around 340 account records between the 4 of them. These are rolling up from (client) ...
0
votes
2answers
49 views

Newest records for a SOQL Query

I have the Object Case and the Object Agent and I have multiple Agents created by Case. Both of them have their Ids. Agent has a field CaseId and I want a List with the newest Agents related with a ...
0
votes
0answers
43 views

FIELD_INTEGRITY_EXCEPTION, Every asset needs an account, a contact, or both and field comparison

I have been trying to insert new assets to the asset table and use the serial_number to check if the asset already exist before inserting it to avoid duplicates. I'm at the point where I am trying to ...
0
votes
1answer
43 views

Batch with 3 related objects

Suppose i have 3 related objects: Continent - Country - City. Country object is child object of Continent and City is child object of Country. City -> Country -> Continent. I would like make changes ...
1
vote
1answer
28 views

Working with searches and query API. Executing a SOQL query using “IN” clause

select Id, Name from Contact where Email in ('apple+super@gmail.com','apple+100@gmail.com') Can anyone help me to query this using the salesforce query api endpoint. The endpoint that I have tried ...
0
votes
1answer
39 views

Unable to select Filtered Data Extension as target in SQL query in Marketing Cloud

I have created 2 filtered data extension from a shared data extension using filter. I want to automate those filters so that the DE's will be auto refreshed. I realized that automating filter ...
1
vote
3answers
596 views

Is There a Way to Know if an Id Exists Without Querying?

Is there a way to know if an Object ID exists in a sandbox without querying for it? Sometimes we store ID's in Metadata/Custom Settings and I'm curious if there is a way to know if the ID exists ...
2
votes
1answer
65 views

Journey, tracking subscribers in WAIT state

I have a question about Journeys, can I track subscribers that are in a state of WAIT inside a journey? I tried to track with Data View: Journey Activity but the column JourneyActivityObjectID is ...
0
votes
0answers
10 views

Error while querying ThirdPartyAccountLink object

I have an external authprovider which our external users will login to Salesforce using that. I want to know total count of active ones who logged into Salesforce using that SSO Provider name. below ...
0
votes
1answer
57 views

Find active subscribers for each month for last 6 months

I am trying to find out the number of active subscribers who opened at least one email in the last 30 days, I would like to find this info for last 6 or 12 months, to monitor the growth of active ...
0
votes
3answers
69 views

SQL query: not working properly for blank values

I have an issue, where SQL queries do not work correctly for blank values. A very brief summary: I have TABLE A with 200k rows (no duplicates). In this table there is field called MailingCountry. ...
1
vote
1answer
24 views

Using LAST_N_Months:3 on CreatedDate in databaseQuery

I am setting a string qryDate = 'Last_N_Months:' + x - so it could be Last__Months:3. I create a string qryString = 'SELECT field1 FROM Case WHERE CreatedDate=: qryDate' and then do: result = ...
0
votes
1answer
38 views

Populating Data Extension with tracking aliases

I have a welcome journey in which the subscriber at a point chooses which room needs a redesign. The links for these 3 rooms have tracking aliases like this: Image_RoPLivingRoom CTA_RoPLivingRoom ...
0
votes
2answers
48 views

DateDiff not working

I am using the datediff function and it doesn't seem to be working. What I am currently using DATEDIFF(year, creation_date__c, SYSDATETIMEOFFSET()) AS AnniversaryYears It just gives an empty ...
0
votes
1answer
62 views

Query to get ContactKey and SubscriberKey in results?

I am trying to create a query in marketing cloud that will give me both ContactKey and SubscriberKey in the results. The background: we are setting up MobileConnect. It seems that between ...
2
votes
0answers
24 views

A way to stop hard deleted records to come in query results

I'm querying deleted records in a query like below Select Id, Name from Lead where isdeleted = true ALL ROWS Records hard deleted from recycle bin using emptyrecyclebin() call still coming in the ...
2
votes
1answer
34 views

Can SQL select values in one table to match a field in another table with wildcards? (Value like %value%)

We have two tables - one is the _click table and the other is a catalog of ProductIDs and we'd like to find all the clicks from the previous day where the ProductID is in the LinkContent field. The ...
0
votes
0answers
37 views

How do I format a query to pull out all records where the date = max date of the records?

I have an object that stores performance data for another object (eg Account). The performance data is loaded at various times (ie can be monthly, quarterly, annually) so there will be multiple ...
0
votes
2answers
44 views

How to retrieve total number / count of records stored in Big Object?

Even this seemingly easy task is impossible to do. For some reason, even when I loaded millions of data into Big Object, it somehow isn't reflected in Setup > Storage Usage Given sometimes it ...
0
votes
1answer
34 views

SOQL Getting Related Records of External Object

I am trying to figure out how to write a SOQL query to get some related record data. I have an external Contact object I am bringing into my org. It has a field on it that I created an indirect ...
0
votes
1answer
25 views

Select MALFORMED_QUERY

I am trying to make this select: select COD_CID__c, COD_CID__r.Name, CreatedDate from Hipoteses_Diagnosticos__c where CreatedDate = LAST_N_DAYS: 365 GROUP BY COD_CID__c, COD_CID__r.Name ORDER BY ...
0
votes
1answer
34 views

How to write Expressions in SOQL Query

I have a custom object Professor Professor { Name(Text) , Salary(Number) , Bonus(Number)} I wrote the query in Developer console select Name from Professor__c where (salary__c + bonus__c) > 7 ...
1
vote
1answer
54 views

Generate GUID to existing records

It is possible to assign a GUID value to each existing record in a dynamic way? I'm recently add a hidden field with this value in a register form, but I need to assign a unique value to records that ...
-3
votes
1answer
36 views

how to use like in where clause of SOQL for string

for below query like is not working static final String OrgUrl=system.URL.getSalesforceBaseUrl().toExternalForm(); string sl=[select Identity_Provider__c from Org_Url__mdt where label like:'%'+...
1
vote
1answer
25 views

Additional Fields Added to _Open Query

I am trying to get tracking information on people who did not open a specific email campaign. I was able to get it to work using the below query: Select distinct s.SubscriberKey, s.JobID, s.BatchID, ...
0
votes
0answers
27 views

Help with 200k record limit for SOQL query (query selectivity error) [duplicate]

We are experiencing an issue around an insert and update for Opportunity Line Items. When creating/updating the OLI, a class is called to creates/updates records on a custom object. The error message ...
0
votes
1answer
68 views

Marketing Cloud: Error: Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object

Everyday we have an automation running to import new magento customers from an FTP file to our contact DataBase. Today, for the first time we had this error message. Query failed during execution. ...
1
vote
0answers
14 views

How to create an index for already released field in managed package to automatically propagate it to all subscribers on upgrade

We are receiving bunch of errors from subscribers' orgs where our managed package is installed: "System.QueryException: Non-selective query against large object type" After conducting our local ...
1
vote
1answer
42 views

Query Open from Journey Builder

I tried to do the SQL for get who opened an email in journey builder. I use this SQL below, but no records populates my Data Extension. I tried to use whith and without the prefix 'ent' before the ...
0
votes
2answers
55 views

SQL query to find subscribers who were sent with the same Email Name

I've been using marketing cloud for almost a year now but not really exploring the SQL queries since i'm not really familiar with this. I'm also aware that my friend set up my account with lots of ...
0
votes
1answer
42 views

How to use SOQL LIKE with IDs?

I need to use SOQL LIKE operator with IDs? List<Account> accounts = [SELECT Id FROM Account WHERE Id LIKE '001%']; I'm aware that the LIKE operator is supported for string fields only, however ...
1
vote
2answers
76 views

Query Data Extension with Left Join

I have one data extension that is about 9 million records (IGO 3 months simple). It has 2 columns, SKU and CustomerID. Both of the fields are NULL so there is duplicated CustomerID's and SKU's. I'm ...
0
votes
1answer
34 views

What query is causing error: “List has no rows for assignment to SObject”

The error occurs when loading the page for a custom object. My understanding is that this error means a query did not return any results, but I don't know how to begin identifying what query that is....
0
votes
3answers
73 views

Query did not opens in the past 180 days

I have the following query to find all subscribers that have not opened in the past 180 days: Target Data extension has: SUBSCRIBER RELATIONSHIP ContactKey relates to Subscribers on Subscriber Key ...
0
votes
1answer
59 views

Multiple Objects - Conga SOQL

So I have my Conga Invoice button on my Opportunity have a query of Select a,b,c from OpportunityLineItem where Opp.id. But I also need to get the other info from Custom Object(Property) This property ...
2
votes
1answer
47 views

SOSL query on Lightning Knowledge Articles returns only 250 records even if there are more than 2000+ matching records

Below query returns 250 records FIND {*test*} IN ALL FIELDS RETURNING Knowledge__kav(Id, Title WHERE PublishStatus='online' AND Language= 'en_US') Below query returns 2000 records FIND {*test*} IN ...
0
votes
0answers
32 views

Does indexing a custom field in the below scenario will help with Non-Selective query error?

Background : I have a object(Foo__c) with two columns(Value__c, Type__c). Type__c is a picklist, with two options(A and B) and Value__c is a text field. Running into Non-Selective query error when ...
0
votes
1answer
59 views

How to create a nested query that fetches opportunities, Content Document and Content Version [duplicate]

I am trying to fetch all files that are associated with the opportunities in 'XYZ' stage. I am trying to construct one nested query that would first fetch all the opportunities in that stage, then ...
2
votes
1answer
275 views

Edit Permissions for Guest Users after “Secure guest user record access”

Salesforce Alerted me that at the end of February we would be forced into the security update for "Secure guest user record access". I tried this in my sandbox and it seems to have some adverse ...
1
vote
1answer
58 views

Find Subscriberkey based on Subscriber ID

I have a daily file with only Subscriber IDs sent from Audience Studio into Salesforce Marketing Cloud. I have imported the file into a data extension called 'SubscriberID'. I will need to find the ...
2
votes
1answer
170 views

SOSL not returning all expected results

I'm trying to SOSL search a custom object we have, by a phone number field but the results are not working as I'd expect. The issue seems to be around missing characters at the start of the search ...
0
votes
1answer
65 views

Can you query two levels up in a hierarchy?

Hard to explain, but we have opportunities of many different types. I need to only get opportunities of a specific type, which i have done. Now I need to only get projects that have opportunities of ...
0
votes
2answers
56 views

We have a SQL Query looking for _Open and _Click data that is failing because it keeps timing out

The query is intended to populate LastClick and LastOpen data in our Master Subscribers DE. Here is the query: SELECT a.Email, a.LeadUID, MAX(o.EventDate) as LastOpenDate, MAX(c.EventDate) as ...
4
votes
1answer
57 views

SOSL Doesn't find data with wildcards

I'm working on a query to find some duplicate records by name. I take the name and replace anything thats not a letter with a wildcard. I wind up with a query that looks like this: FIND {Name*Name*} ...
0
votes
0answers
26 views

Can we query all processbuilder exist in system for an object. I am creating a document for a team

Is there any way I can export or query any process builder exist for particular objects from Org. I am creating a documentation for a quite complex org where there are many process builder each object....
0
votes
1answer
265 views

Database.Query does not return fields with null value

Hi i'm executing this query using Database.Query(query) Where query is SELECT field1__c, field2__c, field3__c FROM Object1__c On the current record, field3__c is NULL but when i query on the ...
2
votes
2answers
154 views

How to query field names from custom object by data type?

I have custom object ExchangeRate__c. How to get all fields, which have data type "currency" and put their field names in a string?
1
vote
2answers
89 views

Salesforce Data as Entry Event - System Generated Data Extension is not getting updated

I have a journey that is using Salesforce Data as the entry event. SFMC automatically creates a data extension for that journey and automatically links it in Data Designer in the Sales and Service ...
0
votes
0answers
37 views

Batch Apex Class quey

I am new to Salesforce and Apex language. So I have a use-case where I have to first make two custom objects named Aggregate Book of Records with fields year(type picklist with values from 2019-2025),...