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.

1
vote
1answer
38 views

Select Knowledge object in SOQL query

I'm trying to get all articles which are published and online. In my user I turned on all permission set and so one to have access to Knowledge. List<Knowledge__kav> myList= [SELECT Id, ...
0
votes
0answers
5 views

Not able to query the data from heroku

I have imported my salesforce contact object data to heroku using heroku connect. I have also used heroku postgres addon for database. I have done this in php and have deployed the app to heroku ...
0
votes
1answer
22 views

Can I query Salesforce Queue and can I do it using the metadata or tooling APIs?

Can I query Salesforce Queue and can I do it using the metadata or tooling APIs? Looking to quickly access this data from Salesforce inspector, also looking to see if there is a way to check if a ...
0
votes
1answer
22 views

How to query pending server-call actions made from Lightning Controller?

I've been searching through the documentation but I couldn't find anything explaining how to query pending server-call actions made from my lightning component controller. I can debug using the ...
0
votes
1answer
39 views

Simple query troubleshooting

I have a simple query that is erring out. I cannot figure out why, as it is so simple. The target data extension has a primary key on contact_key. Both fields (unsubscribe & newsletter) from ...
0
votes
1answer
25 views

Query Activity for suscribers that opened campaigns

We want to get a Data Extension with only de emails of subscribers that opened certain JobIDs. I ran this SQL Activity but the targeted Data Extension shows 0 records after it finished running. What ...
2
votes
2answers
124 views

is it possible to put a list directly in a SOQL query?

Is it possible to put a list directly in a SOQL query form the query editor? Let's say I wanted to query over a list, is the following possible in any way? SELECT Id, Email FROM Contact WHERE ...
2
votes
1answer
26 views

How can I correctly convert List<SObjectField> into a list of comma-separated field names to build a SOQL String?

I've created a generic selector class as follows: public inherited sharing class DAO_SObjectSelector { public List<SObject> selectFor(Query query) { return Database.query(query.toString()); ...
0
votes
1answer
22 views

Extracting Open counts from Data Views and match against Salesforce Account ID's

I would like to extract my Opens into a statistics table that contains columns like Last Opened 7 Days. To achieve this I am using the Data Views to query out the _opens table. The target Data ...
0
votes
1answer
18 views

Difference between lock row and Record Currently Unavailable

Good day everyone, Last time,I encounter this error saying : UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record. I try to search a possible fix and I found that adding 'For ...
0
votes
0answers
14 views

Topcontent issues in Library

Trying to display Top contents by Number of downloads If I execute this query in query editor SELECT ContentVersionId cvid, Count(ID) total FROM ContentVersionHistory WHERE Field = '...
0
votes
0answers
12 views

How to display featured content in Library for patner user

How to display Featured content in salesforce. I used FeaturedContentDate & FeaturedContentBoost in query filter. File is shared with Many Libraries & partner users. I faced above issues: ...
-1
votes
2answers
71 views

List size isnt working as expected for partner user

I have observed very weired nature in Lists result. I run this query in query editor: select id, Title, Description, FileType,FeaturedContentDate,FeaturedContentBoost,ContentDocumentId,TagCsv from ...
1
vote
1answer
27 views

Num of download option in contentversion query

Querying Top contents: select id, Title, Description, FileType,FeaturedContentDate,FeaturedContentBoost, Owner.Name, VersionNumber, ContentDocumentId,TagCsv from ContentVersion where ...
1
vote
1answer
19 views

Calculated field in SQL not inserting to Data Extension properly

I'm trying to calculate open ratio for our subscribers by adding up the number of emails they have been sent, number of those emails they have opened and then finally trying to calculate the ratio by ...
1
vote
1answer
25 views

How to Query for logged in username [Python:SimpleSalesforce]?

Tried to do user=sf.query("SELECT Id, Name FROM User WHERE Id = :UserInfo.getUserId()" but getting error: content = [{u'errorCode': u'MALFORMED_QUERY', u'message': u'\nSELECT Id, Name from User ...
0
votes
0answers
21 views

How to access Salesforce tables from unix shell script?

I have requirement to retrieve Salesforce source table counts via unix shell script. This shell script can be called in Informatica workflow as command task. Can someone please provide me with sample ...
5
votes
2answers
126 views

Allow simultaneous writes to the same Data Extension

I have a use case where I need to bring _PushAddress data from 60 Business Units back to the Global Business Unit. For information _PushAddress has a restricted view of data available in a single ...
0
votes
1answer
19 views

apex query error with local variable

This my query : Date todayDate = date.today(); PropositionCommerciales = [SELECT Id, Compte__c.Id AccountId, ...
0
votes
1answer
32 views

Extending WHERE clause with condition from another query

I have two different queries which give the results, however is there a way to combine 2 queries and extend the WHERE clause as below: Query 1 SELECT Id, Name, (Select ID, Name, Object_C__r.Name ...
0
votes
1answer
13 views

Default external access Setting Issue for site Guest user

If I query this record I will get one record Query Editor & Anonymous window select id,Name from Account where Name='TestPartner' but In coding, system.debug('company domain---->'...
2
votes
1answer
39 views

Querying top & featured content in salesforce Library

How to query top and featured contents in salesforce Library. I checked in documention but I didnt find anything https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/...
0
votes
1answer
38 views

UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record during Insert

Good day Everyone, I know there are lots of questions which is similar with my question. But I still post this because I did not find any case which is similar with mine. I am working with some ...
-2
votes
1answer
34 views

Write an aggregate query to return the sum of Closed Won opportunities for the current year (Close Date = THIS YEAR) grouped by the account [closed]

AggregateResult[] groupedResults = [SELECT AVG(Amount)aver FROM Opportunity]; Object avgAmount = groupedResults[0].get('aver');
0
votes
1answer
35 views

Retrieve data on a single query

I need to retrieve an object's info from a single query. Lets say I have 4 objects (A__c, B__c, C__c, D__c). The relationship is that B__c has the master-detail relationship with A__c and B__c is also ...
0
votes
2answers
57 views

Very basic _click query not working

I have a very basic _click query like this: SELECT SubscriberKey FROM _Click WHERE LinkName = 'XXX' OR LinkName = 'XXX' OR LinkName = 'XXX' The XXX are ofcourse dummy text but in my query i have ...
7
votes
2answers
89 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
36 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
22 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
60 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
17 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
21 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
27 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
36 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
2answers
46 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 ...
0
votes
1answer
30 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
46 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
35 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
42 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
31 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
2answers
56 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
49 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
80 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
44 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
538 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
25 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
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
3answers
62 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
26 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 ...