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

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.

0
votes
1answer
13 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
20 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
21 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
29 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
61 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
30 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
42 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
19 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
13 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
16 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
19 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
33 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
11 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/...
1
vote
3answers
121 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
13 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
29 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,...
1
vote
0answers
18 views

Query timeouts for community users after Winter 19 update

We have a Customer Community with a custom Visualforce application that we built. After Winter '19 update on our production instance over the weekend, some of our query functions are timing out or ...
0
votes
0answers
9 views

Query Access for Group, Group Member, RecordType, UserRole

What permissions / controls, if any, are there to control whether a user can query group, group member, recordtype, or user role? If they are not a member of a group (role, group), can they query all ...
1
vote
1answer
23 views

Comparing dates in query activity with null values (in Marketing Cloud)

I query the _Opens data view which updates my SubscribersMain Data extension with the latest email open dates, I have noticed that the query blanks out the last_open_date when it shouldn't but cant ...
0
votes
2answers
21 views

SOQL Query To Return Any Open Tasks Assigned To a User

As the title suggests, I'm simply trying to return a list of open tasks for a particular user so I can mass-change owner using Dataloader. I've worked my way to this query: SELECT Id, AccountId, ...
-1
votes
1answer
19 views

apex query optimization

I have this query (somewhat striped down for brevity) where the bind variable of ids is "Set ids" from a trigger. What I want to do to is get the data for all the ids from the trigger and where the ...
0
votes
2answers
21 views

SOAP connection and I have a query - Select from array of IDs via SOAP

I have a SOAP connection to SFDC in PHP and I have a query that looks like this: $query2 = " Select Name, StartDate from Campaign where Id in (7016F0000025iaJ, 7016F0000025iZV, 7016F000001PvKf)"; ...
0
votes
0answers
15 views

Is there an object/table in salesforce that holds pagelayout assignments?

I am trying to get a list of which pagelayouts are in used withing the org. But I am not able to find the query/REST call to give me the list of Assignment of page layouts. In the Metadata object: '...
1
vote
1answer
34 views

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

Every day a file is dropped on an FTP which consists of people with their relationnumbers (relatienummer) and the products (documentnummer) that they have bought. However, the same person can buy ...
0
votes
0answers
18 views

Email-to-Case generalization

I'm writing a code that creates objects from Strings like this: Object_API_Name.Field_API_Name:value for example: Contact.Email:foo@bar.com I'd like to use this in email-to-case, so the String is ...
0
votes
1answer
37 views

Datetime in WHERE clause

I am facing issue with Datetime column in WHERE clause. Below two queries are giving different counts. SELECT COUNT(CallTime_c) FROM SF...TableName WHERE CallDateTime > '09-13-2018 09:01:00' and ...
0
votes
1answer
15 views

Retrieve the Package Name Instead of Publisher Name

Is there a way to retrieve the Package name of the installed packages in an org instead of the Publisher Name? When you query SELECT Name FROM Publisher, you'll get Docmation and Salesforce (See this ...
0
votes
1answer
32 views

SQL Query Openers Fail

I am trying to run a query of all of our email openers that are older than 64.5. My SQL looks right but I keep getting the following "Automation failed due to system error." is this on my end or on ...
0
votes
1answer
11 views

How to update contact fields related to a campaing

I want to update a field on the related contacts of a campaign with a field of the related campaign when the campaing is updated. I can get the contactid trough CampaignMembers but how do I get the ...
1
vote
0answers
30 views

Mobile Push Logs in Marketing Cloud

Is there a way I can query the push messages sent through MC for a particular subscriber (i.e. via Data Views?) If not, how else have people something like this, I'd want to stay away from using ...
0
votes
2answers
30 views

Dynamic query into a map

In a vf controller, I'm trying to pass a string and a set into a query that goes to a map. I can't seem to get both the set and the string into the same line. Example: private Boolean ...
0
votes
0answers
26 views

Help with Automation studio Query - Primary Key Constraint

Getting the following error: Query failed during execution. Error: Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object 'LIVE_ClearToClose'. The duplicate key value is (...
0
votes
1answer
54 views

Help With Query

I want to fetch data from sales cloud but the field i am using is date filed with the format : MM/DD/YYYY. The query i am using in marketing cloud activity looks like : Select * from ...
0
votes
1answer
37 views

How to setup Birthday Email on Automation Studio?

I want to send a birthday email. So I already connect both the cloud and get the record of contact object into the sync data extension and I also created a standard data extension in marketing cloud. ...
0
votes
1answer
38 views

Synchronized Data Extensions

I want to use Synchronized Data Extensions as a standard data extension but i am not able to copy data extension . I Created the same fields into the standard data extension now how can we get the ...
1
vote
1answer
30 views

Cant do null check in sub query record

I have done a parent parent to child query List<Opportunity> opportunityList = [SELECT Id, Field__c, (SELECT Account__c,Contact__c,CreatedDate, LastModifiedDate, Description__c,Id,Note_Type__c,...
0
votes
2answers
40 views

Marketing Cloud SQL Query to determine no of null columns

I am trying to execute the below query in a query activity. The intent is to find how many emails a customer record have. The query is executing without errors but the No_Of_Email column is not ...
13
votes
1answer
138 views

Can Cast Child Related List to Single SObject Record - Compiler error?

This situation came up in code review and I was sure the old version should have caused a compile fail: List<Child__c> children = new List<Child__c>(); for (Parent__c parent : parents) { ...
0
votes
1answer
45 views

Need help writing query for 3 custom objects in master detail relationship

I'm trying to create a table on Visualforce page like this. Each pricelookup's description has it's own activity and purchase info. Custom parent object - Pricing_Lookup__c Custom child object - ...
0
votes
1answer
16 views

Getting “Nesting of semi join sub-selects is not supported” when submitting query

I'm using Java to query SF, using the aPI version 33.0. I'm trying to submit the following query SELECT Id, EODBID__c from Account where Id in (Select AccountId from Opportunity where RecordTypeId ...
0
votes
2answers
67 views

Query alternative for NOT IN

I have 2 big tables and would like to pull all fields on table1 if the 'Email Address' IS NOT exists in table2. I have below but timeout. SELECT [Subscriber Key] , [Email Address] , [...
0
votes
1answer
25 views

How to make variable show the count of records from a dynamic soql query [duplicate]

I have a custom controller with a variable 'count.' I want this to update on the page every time the account list updates. Right now it's static. It just displays the original number of records in the ...
0
votes
1answer
33 views

Using query to populate target data extension for resending automated mail

Every week we send out a mail on tuesdays. This mail is named so it always contains this: "TOBERESENT". Every saturday an automation sends out a mail that is an altered version of the tuesday mail. ...
1
vote
1answer
25 views

Getting info on files that were shared between dates [closed]

I'm fairly new to Salesforce API, I'm trying to get information on files that were shared between dates. I would like to know how to retrieve this info using REST API. Is it even possible to query ...
0
votes
1answer
103 views

Violation of PRIMARY KEY constraint. Cannot insert duplicate key

Getting error on the query and is below. Email_Master primary key is 'Email Address' and thee target Data Extension primary key is also 'Email Address'. Can you help/advise what is the issue on the ...
0
votes
1answer
44 views

Query Error: Old style JOIN (ANSI JOINs) syntax is not allowed

I'm trying to build a Segment Count history table. There's three columns in this table. I want to insert 5 rows daily. The code below worked (minus createdate). I needed to add CreateDate so as not to ...
0
votes
0answers
39 views

Query on Suppression List Does not Return any Record

Ive tried the following code but it does not return any record. Select l.SubscriberKey as SubscriberKey, l.[Status] as Status, l.ListName as ListName FROM [_ListSubscribers] l WHERE l.ListName = '...
1
vote
1answer
57 views

How to query the KnowledgeArticleVersion and Linked Article Objects in sfdc

i get "SELECT id, abdulking__Knowledge_Linked_Artical__c ^ ERROR at Row:1:Column:12 No such column 'abdulking__Knowledge_Linked_Artical__c' on entity 'KnowledgeArticleVersion'. If you are ...
1
vote
1answer
30 views

Finding a rider's origin station

Hi: I have a query that I want to run that pulls back the date of a first ride and the depart station. This is my query to date: select Distinct(b.EmailAddress), MIN(cast(b.DepartureDate as Date)) ...
0
votes
1answer
79 views

Invalid Type Error

I am trying to fetch a list in my controller but I am not able to query the object directly and not even able to declare an empty list in my class Here is how I am declaring this in my class List<...