Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

7
votes
2answers
88 views

Throwing System.QueryException on Batch Class for field “IsArchived” on Product2

We're using Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap()to fetch all the fields in Product2 and build a dynamic query. When the string is used in database.query() method, ...
0
votes
1answer
29 views

Can't Query All Fields in AllSubscribers List

I need to grab fields within the AllSubscribers list. I attempted a simple query, but I'm getting the error "Invalid column name..." for the columns that I've commented out in the screenshot below. Is ...
0
votes
2answers
21 views

Combine and Query 2 Child object to a Parent Object

I was wondering can you combine 2 child objects to a parent object. SELECT SourceIp FROM LoginHistory WHERE UserId IN (SELECT Id FROM User) SELECT City FROM LoginGeo WHERE CreatedbyId (SELECT Id ...
0
votes
1answer
36 views

SQL Query Error - Violation of Primary Key constraint

I am trying to take my information from a Data Extension which contains new customer emails and put them in another Data Extension which severs as our companies master list. I am able to populate ...
0
votes
1answer
16 views

Bubbling up an Account hierarchy to capture top most Parent Id from query

Based on some of the answers I've browsed I think this might involve 2 queries. I feel like this is probably a pretty common problem so I was hoping someone would have a quick answer or at least be ...
1
vote
1answer
16 views

How to use VSCode to find which reports are using a specific field

I have used Eclipse in the past but unfortunately, Eclipse and Force.com IDE no longer work for me. I have switched over to VSCode along with the Salesforce DX and forcecode extensions (among many ...
0
votes
1answer
17 views

Executing Function with Batch Execute Class

I am attempting to refresh an account list that I utilize within the execute function of a batch class. I am trying to do this by wrapping the query in a function. My purpose in doing this is so I do ...
0
votes
2answers
26 views

Child to parent relationship queries and data sharing [duplicate]

I am trying to use Child to Parent Relationship queries, but the documentation! doesn't cover the parent record's accessibility. Say I am owning a Contact, but I don't have access to its parent ...
0
votes
2answers
32 views

How to get DataCategory name and not Unique name from Knowledge Base with SOQL?

I started using the Knowledge base and i want to pull out all the knowledge base category group names from it.  I am using the following SOQL statement: Select Id, Question__c, Answer__c, (Select ...
0
votes
1answer
38 views

Retrieve the subscribers from each business unit

Starting from the All Subscribers list of the parent business unit, I'm trying to know which subscribers are being part of each child business unit. As it is not defined any Subscriber Filter, how ...
-2
votes
0answers
34 views

Accessing Apex Query Results [duplicate]

I have code to capture fields from several objects (keyed by AccountID) and populate fields in another object. It works for the Account object fields, but I get variable not found for the next (other)...
0
votes
1answer
27 views

Query for Opens last month

I would like to write a query to find subscribers who opened emails sent from journey builder in the previous month, but this query returns 0 records. May I know where I did wrong, please? Thank you. ...
0
votes
2answers
44 views

Rewrite query to make it without subqueries

I have some custom objects displayed on schema. I need return vacancies which have last active interview at least week ago. I have some query: List<Vacancy__c> ids = new List<Vacancy__c>(...
1
vote
1answer
34 views

Accessing fields from inner query [closed]

Below is my query SELECT id,(SELECT id,ServiceResourceId, ServiceAppointmentId FROM ServiceResources), ParentRecordId FROM serviceappointment This is the result of what it looks like in the dev ...
2
votes
1answer
37 views

How to make HttpGet service pagination with a limit of a million or more?

Offset can take only 2000 records, but I need more. How can I send to the callout side 1 mln or more records with pagination and step of 100-200 records per 1 page? I mean when callout request for 100 ...
1
vote
1answer
28 views

How to perform SOQL query after retrieving access_token and instance_url via oAuth2 flow?

I have successfully setup my oAuth2 flow, created a Connected App and I can retrieve an access_token and instance_url just fine. Now that I have those two pieces of data, how can I perform SOQL ...
0
votes
0answers
15 views

How to have multiple filers

I my trying to narrow down my query by have more than one filter, within a REST API that allows me to enter Status, Case Number and Keyword within a account. Below the code. Below the code which ...
0
votes
2answers
48 views

Marketing cloud Query Single field split into multiple fields

I have a data extension that has duplicate email addresses with each duplicate having a different rank associated with it. I need to dedupe the email addresses but keep the different ranks in added ...
0
votes
1answer
37 views

SOQL Query Inner Join

Could you please help me with the syntaxis of this SOQL Query? I would like to do an INNER JOIN between A and B on A.FamilyMember=B.ID SELECT A.FamilyMember__c FROM A WHERE A.StartDate__c > TODAY ...
0
votes
1answer
51 views

SQL Query to pull only Hard Bounces?

I currently manually update a database by exporting bounced email addresses using the code below: SELECT DISTINCT UPPER(EmailAddress) as EmailAddress, SubscriberKey FROM _Subscribers WHERE Status = '...
1
vote
2answers
39 views

Populate one data extension from 5

I have 5 data extensions with the same fields and i would like to join in one. Query would be the best method? How i can applied a query that will get five data extensions? The fields above: SELECT ...
2
votes
3answers
492 views

SOQL Like Query?

I am trying to make a query that will search for accounts with a name similar or exactly matching a field value. So for example I have "Sales-Force" in the field. There is an account called "...
0
votes
1answer
24 views

How to select last order on SF Marketing Cloud?

I have a database consisting of over 1 million orders, I'm looking to select the last order (indicated by OrderDate) for a customer (indicated as CustomerID). Here's what I've tried so far: SELECT ...
0
votes
0answers
30 views

Converting Lists into Data Extensions

Currently, all of our subscribers are in Marketing Cloud lists and not data extensions, and our team doesn't have the bandwidth to convert all of our web forms to have the data go into data extensions....
0
votes
2answers
37 views

SOQL with two conditiions

I am retrieving two properties from a record (object1) on update, and I want to look up another record (object2) that has both of these properties. So, for example: object1record.email = 'test@test....
1
vote
2answers
47 views

“Attempt to de-reference a null object” on VF page

I am creating a product selection process via a custom apex controller and visualforce page. When the page is rendered it gives the error message "Attempt to de-reference a null object". The end ...
0
votes
1answer
23 views

Is there any developer console sort of feature available to check & preview salesforce marketing cloud sql queries?

In marketing cloud while running a sql query, to check results I have to create a data extension and store results into it. I want to know if there is any alternative available through which we can ...
0
votes
1answer
18 views

How to test catch-part of the method? [duplicate]

I tried to put null rows and do many another things. I can't test this catch. It writes System.QueryException: List has no rows for assignment to SObject. public List<MyObject__c> getList(){ ...
0
votes
1answer
34 views

How to use a few conditions for the same SOQL values?

I have a few conditions for the same fields of record. But I get the result only from last condition. How can I use them all? public List<Item__c> serch(){ String[] filters = new String[0]; ...
0
votes
1answer
28 views

Populating Data Extension Column from Existing Columns [closed]

I would like to populate a Data Extension Column from existing columns Say I have a Data Extension Like this FN | LN | FN LN Jack|Johns| Null Jane|Jones| Null Luke|Smith| Null FN and LN are ...
0
votes
2answers
73 views

Query of LOB fields caused heap usage to exceed limit

I understand that this has been asked many times before. But I haven't been able to find a conclusive answer or guide to solve the issue. When we add a new product to an opportunity we get the ...
0
votes
1answer
30 views

Event Owner Details SOQL

I am trying to run a SOQL query in workbench to pull details related to the Event (standard object) owner. I've been able to user Owner.Name within the query but haven't been able to successfully ...
2
votes
1answer
19 views

Identify users with incorrect password policy settings on their profile

Is it possible to query for the users whose profiles do not have the correct password policy settings? I was trying to first query on the profile for the password policy settings, but I'm only seeing ...
0
votes
1answer
37 views

Error when building a interaction SQL Query in Marketing Cloud using a semicolon

Working in Marketing cloud where we are building a query that splits apart data from a single column into 4 separate columns where the delimiter is a semicolon. Error is displayed when doing a "...
0
votes
2answers
39 views

Trigger.New value to compare with all records

I has objects Contracts__c with fields(Start_Date__c and End__Date__c) and related obj Actor__c. When i insert new contract i trying to check does the actor already has a contract on specified dates. ...
0
votes
1answer
25 views

Query to populate a field with different name in data extension

I am newbie in SQL, but i have to populate one data extension (name = TEST A) from another data extension (name = TEST B). The fields in 'TEST B' has name like: 1. Name 2. State 3. Email Address 4. ...
0
votes
1answer
107 views

SFMC - Querying All Contacts with SQL Query Activity (System Data Views)

I am trying to create a data extension that contains all contacts from my enterprise account. I need a complete list of contacts as we are billed by SFMC per contact. Querying the data view ...
0
votes
1answer
31 views

How many records could we extract from SOQl query on User object?

We are trying to run a SOQl query to extract the profileName and userRoleName corresponding to id's in the given list SELECT Id,profile.name,userrole.name FROM User WHERE Id in ('1','2','3','4'...
1
vote
2answers
71 views

Query queues belonging to a particular sobject

Is there a way to query only queues tied to a particular sobject? I have the following query which gets me all the queues. Select id, name from group where Type = 'Queue' I want all queues which ...
0
votes
2answers
34 views

How to query Many.Master.Lookup relationship?

I have this problem with query. I have a trigger on the Account object. When it gets updated I get the IDs from trigger and query all the related Billing Account objects. Then from Billing Account ...
1
vote
1answer
44 views

What are the design patterns how to do a batch callout

I know some basics on callouts but would like some advice on doing multiple callouts. Requirements: I have an external system where guests are registered this could be large amounts. I have to get ...
0
votes
1answer
24 views

How to extract only profile.name and userrole.name corresponding to a particular User object

We have an existing Soql query SELECT Id,Username,LastName,FirstName FROM User we are trying to enhance this query to retrieve profile.name, userrole.name corresponding to each user as per How to ...
0
votes
0answers
19 views

How to map salesforce formula fields to heroku?

I am trying to map Sales-force formula fields to Heroku.. But It is saying synchronization is not happen for formula fields. Please suggest how can I do?
0
votes
1answer
28 views

Random String Generator without duplicate values

What needs to be added (an SOQL query perhaps) in the 'else if' statement which checks the value within the c.Name column and tells if the generated random string already exists, and if so add break/...
0
votes
0answers
25 views

Journey Builder Query

I am trying to use the query supported by Marketing Cloud that triggers Journey Builder Sends by Email across different versions, but the query doesn't seem to be working on my end. Here is the query:...
2
votes
1answer
58 views

SQL Query valid but Automation to populate Data Extension with engagement data is failing

Attempting to create a 'score' data extension for each email contact, to measure engagement levels with email sends. Background: Aware the contact score function is available on Pardot/CRM, however ...
0
votes
2answers
15 views

Workbench does not perform filter for LongText Area field

In previous release, the possibility to filter by Old value/New Value for history object was introduced. https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/...
2
votes
3answers
142 views

Execute scheduled Apex class code on the Developer console

I have the following scheduled Apex code, I want to try it out on the developer console, as salesforce scheduler offers to the run the code, once an hour only. global class examExpiryAlert implements ...
0
votes
1answer
17 views

Child Relationship Query not working with API

I have Accounts and InteractionsReferences. Trying to query something like this (formatted because I'm using GET query: SELECT+Account.Name+,(SELECT+Interaction_References__r.Id+FROM+...
0
votes
0answers
34 views

How to get first day of the month data using queries

Hi all I need to get data first day of The month using queries in marketing cloud I tried below query but it's not working can you please help me on that how to acheive this query. Select Date,...