Questions tagged [soql]

Salesforce Object Query Language (SOQL), modeled on SQL, for accessing information saved in the Salesforce database.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Workbench SOQL query builder login error with Salesforce credentials

I am trying to run an integration example on trailhead called "Automate Order-to-Cash Process Using MuleSoft Flow Designer". The second step of the example, Set up PushTopics for Real-Time ...
0
votes
2answers
18 views

No such column ' connectionreceivedid on entity 'Contact' [closed]

No such column ' connectionreceivedid on entity 'Contact' anyone can help me?
1
vote
1answer
18 views

How to extract field value from nested SOQL query inside APEX

If case is updated I would like to send email to all contacts for the account associated with that case. I am getting list of contacts in map and then looping through the map keyset and then looping ...
1
vote
0answers
19 views

ContentDocumentLink Limitations when querying using LinkEntityId as filter

my apologies if this has been asked somewhere else. I didn't find any answer hence I have to post this question. USE CASE: I am using database.query(queryString); In queryString = 'SELECT id,...
1
vote
2answers
22 views

When use Dynamic Soql ,I query all Records,But I want Queryed records are limited to the permissions of the shared table or Data Auth

Two Users, A and B. Two Leads, l1 and l2, The owner of l1 is A.The owner of l2 is B. When I Use A's account. List<Lead> leadList = [select id from Lead]; // query l1 record List<Lead> ...
0
votes
1answer
24 views

Query CampaignMember associated to CampaignInfluence record

I'm trying to get to attributes about the associated campaign member record when querying Campaign Influence. Unfortunately there is no field such as CampaignMemberId that I can see on the object. Is ...
0
votes
1answer
39 views

SOQL relationship query returns objects. Why?

I have a custom object called 'Intake_New__c' that has a lookup field to an Account object called 'Third_party__c'. The account object 'Third_party__c' has a Hierarchy field on it called 'Parent ...
0
votes
1answer
35 views

GROUP BY sentence in ExecuteSOQL within a Flow builder

I realized that I can use ExecuteSOQL to run a SOQL query within a flow. It works perfect. But when I use a SUM() and Group By sentence, the flow display Invalid interview state after the screen 01, ...
0
votes
1answer
26 views

SOQL to get top X from each GROUP

Say we have data like so Id | Account__c | Some_Field__c ------------------------------- XX1| 001XXXX300 | Whatever XX2| 001XXXX300 | Whateve2 XX3| 001XXXX300 | Whateve3 XX4| 001XXXX400 | Else XX5| ...
0
votes
2answers
26 views

SOQL 101 error too many quries - No query inside inside of any loops

I created a function to move leads from someone who is on vacation however when A user has over 100 leads this error gets thrown even though I dont call soql queries inside of the for loops. Perhaps I ...
0
votes
0answers
17 views

SOQL to search all user group membership of a unique profile

I have a query to search for all users of a unique profile ('Business Control') and return all the Group Names associated with the user ID (UserOrGroupId.) However, the query does not return all the ...
0
votes
1answer
37 views

How do I delete a Remote Site Settings (Remote Proxy) from apex code?

I am not even able to do a query like this, Database.query('SELECT Id FROM RemoteProxy WHERE SiteName='TestSettings' LIMIT 1'); I want to delete a RemoteProxy record from apex code, someone please do ...
0
votes
1answer
35 views

Data table count rows in lightning web component from server side

I'm having a hard time on how to use count in lightning web components. I just want to count how many Active users and how many Inactive users. Can someone please help I'm having a trouble in ...
0
votes
0answers
34 views

Soql with multiple lookups on same object

I am gathering data from the LiveChatTranscript and there are multiple references to user as lookup fields. How do I pick which property I want to use as my reference to user? LiveChatTranscript ...
0
votes
0answers
23 views

SOQL Max on picklist field

We have a custom object "Form" under Case (Case is the master side of master-detail relationship). Form object has many custom picklist fields and picklsit values are: 0 1 2 3 N/A We want ...
-1
votes
0answers
31 views

Get userName for each UserOrGroup in query

Have following query that retrieves a list of the UserOrGroupId and GroupId for all users in the same profile. How can I show the actual userName for each UserOrGroup return that I call in a ...
0
votes
0answers
26 views

On Update of in “Contract year term” field in opportunity the respective other field values must get updated!

I have a term field, based on that total "term" field of contract years rest all field values get calculated. For Eg- if term = 5 , contract will be calculated for 5 years and if term value ...
0
votes
1answer
25 views

Content Version SOQL - WIth custom field in the Where clause Return as null

I have a custom field on Content Version - but When I try to have a SOQL and receive the data its return as null. The next line is working : ContentVersion testContentInsert = new ContentVersion(); ...
0
votes
0answers
22 views

How to get all sharing details of a File

I am using below SOQl to get sharing details of a particular file, With below query I am able to get sharing details if file is shared to a particular User, Group and Organization but Its not giving ...
-1
votes
1answer
25 views

Salesforce Question To Filter out Unique records

Batch Class:- global class EmailNotificationBatchJob implements Database.Batchable{ // public List availableObject = ['Idea, Knowledge__kav']; Map<String, List<Subscription__c>> ...
0
votes
1answer
22 views

Query groups that contain a profile name [closed]

How can I query all groups that contain 'MY PROFILE NAME' as a member.
0
votes
0answers
16 views

Profile Name and Approval Processes [closed]

How can I query for all unique approval process names that a ProfileName participates in such as a submitter and/or approver somewhat using the following? Not accurate nor sure about the actor but ...
0
votes
1answer
21 views

System null argument for JSON generator.Writestringfield()

I'm unable to run the below code as it throws me an exception null argument for JSONgenerator.writestringfield(), i tried adding multiple where clauses to check null exception for Reported first name, ...
0
votes
0answers
28 views

Queueable class Too many SOQL queries: 201

I need to create a HTTPPost method to generate a report so when I did it at first, I had exceeded the number of queries limit so I implemented a queuable class to solve the issue as I have read in the ...
0
votes
1answer
31 views

Not Able To Update Price Entries

I am trying to insert products, then those products then create price entries if they don't already exist but if they do exist they update the previous price entry based on the name of the product ...
0
votes
1answer
20 views

ORDER BY SobjectType

I have the following query and want to sort on the Name of the SobjectType. As it is now the sort is not as expected. I am also displaying the results in a Visualforce page. How can I best retrieve ...
1
vote
1answer
22 views

Parent.Profile.Name and object Object

Using this query to obtain permission on profile but getting [object Object] for the Parent.Profile.Name. Seen other post but still not able to show the name. Running from dev console if that still ...
-1
votes
2answers
40 views

Too many SOQL queries: 101 in a VF page [duplicate]

I'm getting Too many SOQL queries: 101 in a VF page, Could you please advise how I can fix it? for (OpportunityLineItem opline: opp.OpportunityLineItems) { Opwrap = new ...
0
votes
2answers
24 views

Best way to convert SOQL when doing an import of data

I was wondering what would be the best way to convert the below code ,which is importing price book entries, so it doesn't hit the governor limits. for (Integer i = 1; i < csvFileLines.size(); i+...
1
vote
2answers
34 views

LWC for:each needs 3 levels, but SOQL query aggregate relationship limited to 2. What's your best practice?

so I have a structure like: <template for:each={containers.data} for:item='container'> <....> //container info <template for:each={container.Pallets__r} for:item="pallet"&...
0
votes
1answer
28 views

Sorting results different for products in Salesforce

We are facing a weird issue in the results that are sorted by name for products. Scenario 1: User 1 opens the VF page which shows a list of products-sorted by name. They appear in the order with ...
0
votes
1answer
34 views

Get that StageName of the last Opportunity with an specific product at the Account Level

I want to display in a field at the Account level the name of the Stage of the last created Opportunity that has an specific product. e.g. An Account has 3 Opportunities. And I'm looking for the Stage ...
5
votes
2answers
63 views

how can i read the ReferenceTo field on the FieldDefinition object

I'm attempting to use queries (not describe info) to attain which fields look up to a certain object. I'm stuck trying to decode the format of the ReferenceTo field on FieldDefinition. Sample code: ...
0
votes
2answers
30 views

Help with moving a SOQL query out of a loop where I want to check for matching fields between objects?

How could I move this SOQL query out of the following for loop? I'd like to test if there is a shared field between the Lead records and any Account records. public static void SOQLoutOfFor(List<...
0
votes
2answers
40 views

How To Check For Duplicates Using SOQL and Apex

I am currently developing a csv importer for our Salesforce to deal with our way of quoting items, and I am currently trying to make it so that if the product has been added in, it detects whether ...
1
vote
1answer
18 views

Cannot query against notes object in SOQL

Is there a special way that you need to query the notes object in association to lead or contact? I am trying to query a certain created by & subject on the notes field and then take the count of ...
0
votes
1answer
24 views

Is it possible to get the list of all profiles which has access to a particular tab

There are lot of profile in our org. One of the new team member deleted a tab for custom object from a sandbox. It is possible to go to other and see the accessibility manually. But it will take lot ...
0
votes
1answer
33 views

I have a use case where all the converted leads is not working as excepted [closed]

I have updated the code below. Count all the number of converted lead on quota object Lead_Converted_Count__c feild. Below is the code. There is no relationship between quota__c and Lead obecj But ...
0
votes
1answer
24 views

Illegal assignment from List to Account

I'm trying to create a query that returns the Account's Id, Name, BillingState and Phone from an Opportunity however when I do so, I get either: Illegal assignment from List to Account Or Illegal ...
0
votes
2answers
32 views

“Too many SOQL queries: 201” while running batch - how to fix this code?

I want to test my method and I have this error: FATAL_ERROR|System.LimitException: Too many SOQL queries: 201 Class.PatchPanelTriggerClass.deleteDuplicates: line 202, column 1 Class....
0
votes
2answers
25 views

MIXED_DML_OPERATION, DML operation on setup object is not permitted Contact User

Hi i have a problem cuz I'm trying do sth like below: this method has adnotation AuraEnabled Contact contact = getContact((Id)contactId); contact.Inactive__c = true; User user = getUserByContactId(...
0
votes
0answers
21 views

SOQL Group by limit

I have a batch that processes Opportunities by 200 records. They should be marked as duplicates if I have another record with the same value of Custom_Field__c in database. I generate ...
0
votes
1answer
29 views

How can I take all fields (or at least all mandatory fields) for one object?

I need to take all mandatory FIELD NAMEs (not FIELD LABEL) so that I can create object. What are the ways to do it outside copying each FIELD NAME from Object Manager?
0
votes
1answer
27 views

How can I insert the same record (duplicate) but with different ID in Apex?

I want to do this: Interface__c interface = [SELECT Name, Id, Field1, Field2, Field3 FROM Interface__c where Name LIKE :'name']; insert interface; And by the same record I mean record with the same ...
0
votes
2answers
38 views

How can I insert duplicates in Apex?

I need to insert duplicates (the same one field, ID must be different) from SOQL. How can I do this? When I try to insert records with this code: @isTest(SeeAllData = true) private class ...
0
votes
1answer
21 views

Custom metadata types - subquery relationship name

Is it possible to use Custom Metadata Types in the subqueries? If yes, how? In my case, there is a custom metadata type named Custom Actions and there is a Next_Action field in it. When I query for ...
0
votes
1answer
19 views

Why the same SOQL query in apex class in constructor and in apex test method returns different results?

In apex class (in constructor) this block of code: String xxx = 'data123'; // hardcoded xxx = xxx + '%'; List<Interface__c> records = [SELECT Name FROM Interface__c ...
1
vote
1answer
28 views

How to add child records to parent record variable in apex

I'm getting a parent record which is Account acc, and a list of Contacts listContact from another process. Now in order to proceed further I need to do something I could do like: Account acc = [...
0
votes
0answers
31 views

Strange Data View Results

I am running a very simple query to extract data from _Open Data view along with Email Name. select O.AccountID, O.OYBAccountID, O.JobID, O.BatchID, O.SubscriberID, O.EventDate, O.ListID, O.Domain, ...
0
votes
0answers
133 views

OpportunityLineItemSchedules grouping by Date in SOQL

I have a list of products with associated schedules where each schedule has different Revenue and ScheduleDate values. I'm trying to get the get the aggregate of Revenue by DATE across the ...

1
2 3 4 5
95