Questions tagged [database]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
25 views

SOQL: How to get the biggest value from a field and compare to a another on query?

I need to get the biggest value from field createddate and then compare this value to another date on a query/soql. I think about using "order by createddate desc limit 1" but I don't know ...
user avatar
  • 1
-1 votes
0 answers
19 views

Confused with Database.Querylocator limit [duplicate]

I've gone through the apex governor limits doc and got little bit confused about below limits. Total number of records retrieved by Database.getQueryLocator - 10000 Maximum number of records returned ...
user avatar
  • 23
0 votes
0 answers
53 views

how to find out total number of subscribers who were sent 1 email in last from in salesforce marketing cloud

I am trying to get a count of all subscribers (irrespective of BU) - hence I am running the query in parent BU who received ONLY 1 email in previous month. This is my query but it is not returning any ...
user avatar
  • 99
0 votes
1 answer
26 views

Get record field after Error in Database.Upsert

I'm upserting some records using Database.upsert, after that, I'm supposed to get the errors and pass them to a custom logger. The problem is, the way this class works, I'd need to get a field value ...
user avatar
0 votes
2 answers
76 views

Database class partial success can exceed governor limits?

I have a question about the partial success using database class. My question is, if i exceed governor limits. Will the whole transaction be rolleback or i'll have in the database the records that ...
user avatar
0 votes
0 answers
51 views

Error on trying to get Database.getUpdated for an LWC component

I am trying to get records created for multiple objects and the below code is throwing error 'INVALID_SESSION_ID: This session is not valid for use with the API' error when i try calling Apex class ...
user avatar
  • 1
4 votes
0 answers
60 views

how data in _open data view is recorded in SFMC

As of now, our understanding of data views is that data is mostly real-time. But is this true for all data views or only specific data views? if specific, then which ones? Recently, we noticed that we ...
user avatar
  • 99
0 votes
1 answer
99 views

Difference between Upsert and Update database methods

Good morning. Database.update (fields , allOrNothing) Database.upsert (fields, externalId, allOrNothing) I need help to understand why the second parameter "externalId" is not necessary on ...
user avatar
  • 27
0 votes
2 answers
37 views

What is the highest performance way to work with results in a List<SOBject> returned from Database.query()?

I have a custom object called Query_Definition__c that has two fields: SObject_Name__c (text) SOQL_Query__c (long text) Within Apex, the requirement is to take the record details from the ...
user avatar
  • 155
0 votes
1 answer
95 views

Query based on variable field name

I would like to know that how can we search based on a custom field via a variable. For example, if I create a custom field Mobilephone for the standard object Account, then how can I search this ...
user avatar
  • 33
1 vote
0 answers
37 views

Roll up summary field max value in database

I want to export Roll up summary fields to external system. What should be database column length. Should i use int, bigint or any other data type. I was just doing testing in my org and roll up ...
user avatar
  • 3,309
1 vote
1 answer
227 views

Django Heroku: remaining connection slots are reserved for non-replication superuser connections

I recently deployed an app to Heroku using Postgres free tier as database. I am using Django 3.2 Everything was working fine until I started getting a mail with the following error: Internal Server ...
user avatar
  • 111
0 votes
1 answer
82 views

Database.executebatch call in for loop causing Codescan warnings

I have a piece of code that is causing some codescan warnings and it is not liking the database.executebatch in the for loop. The thing is I am not sure to go around it My code: public with sharing ...
user avatar
  • 225
-2 votes
1 answer
36 views

How can I consume a SQL database to create / update records in salesforce using apex? [closed]

I would like to consult you for something, do you know if it is possible that a sql database can be consumed from salesforce? What happens is that account records are loaded into the SQL database and ...
user avatar
0 votes
1 answer
21 views

Is there a database method other than oData?

I wonder if there is a database and method other than oData. I wonder if there is a way to connect in real time like oData rather than importing a csv file.
user avatar
1 vote
1 answer
275 views

How to compare the Database.Error getStatusCode() value against a string (In a clean way)

I have the following code which uses string concatenation to check the err.getStatusCode() if (err.getStatusCode()+'' != 'ENTITY_IS_DELETED'). My question is, if there's a cleaner/better way to do ...
user avatar
  • 574
0 votes
1 answer
276 views

" Error: Could not establish connection. Receiving end does not exist." when trying to create object record

I am trying to insert record in Salesforce after a button click but I receive this error when clicking on the button. Below are provided my JS and apex class for the handling of this operation. No ...
user avatar
0 votes
2 answers
71 views

Using Apex class in salesforce community site

I'm working on a very simple project that uses google books API and I have a problem. I want to save all search history in an object in database and all works fine when I'm logged in my account and ...
user avatar
  • 47
0 votes
0 answers
68 views

Get Campaign name from _Sent dataview [duplicate]

I downloaded the _Sent dataview to my server. Now I need to join the _Sent data with the campaign names to filter. How can I get from the _Sent dataview to the campaign name?
user avatar
0 votes
1 answer
32 views

StandardSetController Pagination problem when use WHERE

I try to make pagination for my table. When selectList change i take Id and want it in my Database Query, but if i add Where to soql the table isn`t displayed. My variable carId is null into if(setCon ...
user avatar
0 votes
2 answers
158 views

Unable to Merge two account and giving the "Database.MergeResult = Invalid field IsCustomerPortal for merge;MERGE_FAILED;"

private static void DuplicateAccountMerge(List<Account> triggerNew) { try{ // Merges a new Account with an existing Account based on matching email addresses. // Old ...
user avatar
3 votes
3 answers
1k views

how to make sure update contact step in journey builder honors primary key?

I am trying to create one Data Extension that can be used to log all contacts going into multiple journeys and then use update contact event within journey to update row when a contact exist journey. ...
user avatar
  • 99
0 votes
1 answer
105 views

Access Contact fields from Opportunity object

I'm showing up with another problem: I'm building a VF PDF page based on Opportunity object and I want to add a paragraph that shows all contacts related to this Opportunity. My approach was as ...
user avatar
1 vote
0 answers
120 views

Database.merge - error "Invalid field IsCustomerPortal for merge"

I'm trying to merge accounts in apex using database.merge - Getting error "Invalid field IsCustomerPortal for merge". This field is available in Account object. The org do not have customer ...
user avatar
0 votes
0 answers
34 views

Api Integration Issue

I have created an api integration in salesforce. From client's website a request will send to Salesforce in form of JSON. This will create record in Salesforce. Sometimes multiple requests are sent ...
user avatar
  • 1
3 votes
2 answers
236 views

How to rollback DML after catching exception in unit test

I have a custom business logic that will block certain profiles from editing/creating/deleting an account. Because of other requirements, mainly around Record Types, I can't use profiles and ...
user avatar
  • 175
1 vote
0 answers
21 views

Heroku & Salesforce - Database question for multiple environments [closed]

Along with our production org, we have 3 full sync sandboxes, Mule APIs and Heroku. We are in the process of setting up an app, which is really just going to hold a postgreSQL database that is written ...
user avatar
  • 83
0 votes
1 answer
106 views

Setting up MC with dedicated db

We have a new MC account we would like to start setting up. We have purchased a dedicated db sku for this account. Are there any implactions or things we should know while setting up this new MC ...
user avatar
  • 213
2 votes
1 answer
123 views

What would be an ideal use case where you would use sObject.addError() over savepoints and rollbacks?

I came across two methods of preventing errors while inserting, updating or deleting the records in salesforce. Let's say I am performing any one DML operation, and I want the transaction to stop if ...
user avatar
0 votes
2 answers
64 views

Can two email messages be inserted at the same time with email to case?

I am setting up a trigger for when email messages are after inserted and we use email-to-case. Is there any way that the email-to-case inbound or normal sf outbound message system could result in two ...
user avatar
  • 1,808
1 vote
0 answers
131 views

Database.saveResult showing only one error at a time

I am trying to write an apexrest service that takes in fields for the Opportunity Object. There are certain restrict picklists on the Opportunity object that I've created. Additionally there are other ...
user avatar
  • 155
0 votes
1 answer
83 views

Multiple contacts for a single person? [closed]

I'm integrating Salesforce with a system that will act as the source of employee records. In the source system, each employee human can be represented by multiple employee records - one per ...
user avatar
  • 2,092
2 votes
0 answers
366 views

Reliable Salesforce JDBC to be used with DataGrip

Do you recommend any particular JDBC for Salesforce (can be paid) which is reliable enough to be used for commercial purposes along with DataGrip (or similar) software? I've been checking similar ...
user avatar
0 votes
1 answer
658 views

How to use insertAsync with processSave

I am trying to understand how insertAsync(sobjects, callback) works with processSave(saveResult) I went through the following two documentations, but couldn't find an example anywhere https://...
user avatar
  • 1,071
2 votes
1 answer
852 views

Salesforce DB query cache (how long?)

How long does Salesforce keep results of a query in its internal database. We know that the first execution of a query takes the longest. Subsequent queries are much faster due to the caching ...
user avatar
  • 29
0 votes
1 answer
105 views

How can I find problematic records in a dml action?

Let's assume I have a list of 100 new records that I want to insert, 10 of these records are missing information which will result in DML exception. Is there a way for me to create a list and include ...
user avatar
  • 1,431
1 vote
1 answer
1k views

Throw a DML exceptions in Apex Batch Class for testing

Below is my batch apex class that updates Account object for example: global class abc implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database.BatchableContext ...
user avatar
  • 4,521
3 votes
2 answers
388 views

Deleting Big Object Workaround Without Using Database.deleteImmediate

Known Issue for not being able to deletg Big Objects with database.deleteImmediate still open. This is the only method mentioned in docs to do this. Workaround to delete 1 X 1 is a joke. Any other ...
user avatar
  • 1,436
2 votes
1 answer
299 views

Salesforce Relational Database ACID

I was reading about relational databases and found that Salesforce is built on Oracle's Relational Database. Based on my understanding, Relational Databases "promise" the following ACID principle: ...
user avatar
  • 43
0 votes
1 answer
132 views

Database Apex class benefits [closed]

The pros and cons of using Database apex class oposite to SOQL direct queries or DML - in which cases we should use database class?
user avatar
  • 687
0 votes
1 answer
273 views

Accessing data of Sandbox from Scratch Org

I want to be able to query, insert and update records of a Sandbox from a Scratch org, only during the development phase. I know that scratch orgs are meant to be populated with just a little amount ...
user avatar
  • 143
2 votes
2 answers
57 views

SOQL - Best practise : what method choosing while retrieving datas?

There are multiple ways of let's say instanciate a list of contacts using SOQL ; My question is : is there a difference between each other, and is there a best practise ? Examples String name = '%a%'...
user avatar
0 votes
2 answers
1k views

Does Database.Update(records, false) roll back the failed records?

If I call Database.update(records, false); will only the failed records be rolled back or will there be no rollback whatsoever? Imagine this scenario, record is updated, kicks of an insert (inside ...
user avatar
  • 170
2 votes
2 answers
3k 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 ...
user avatar
  • 39
0 votes
0 answers
89 views

Duplicate record not added to Database DuplicateRecordSet

We have activated the standard duplicate rules and matching rules for Account. Generally, they seem to work and the duplicate records get written into the tables DuplicateRecordSet and ...
user avatar
1 vote
1 answer
30 views

Object relationships

I have two objects Parent__c and Child__c, Child__c object have a lookup to Parent__c. This code is clear to me, Child__c has a Parent__c field through which it can access to the Parent__r object: [...
user avatar
  • 9
0 votes
2 answers
2k views

SObject.addError() method does not prevent DML Operation [duplicate]

I want to prevent DML operations during certain processing-situations and provoke a Database.SaveResult with an Database.Error[]-List. According to SObject class documentation, the method addError() ...
user avatar
  • 1,330
3 votes
1 answer
583 views

Unable to Create/Update Fields CreatedDate - Database.Merge Leads

I am trying to merge leads with the Database.merge method of syntax merge(masterRecord, duplicateIds, allOrNone), but I'm getting the following error: Unable to create/update fields: CreatedDate. ...
user avatar
  • 1,808
0 votes
1 answer
71 views

What is the behavior of date/time fields regarding daylight saving time?

A user located in São Paulo/Brasil is on the UTC-3 timezone. As I write this post it is actually UTC-2 because of daylight saving time. That means that records created today will have the value of ...
user avatar
0 votes
1 answer
995 views

How to add 'LIMIT :' to String in Database.query?

I have Database.query that sorts records by a few filters (or any filter). I want to set the limit for it. How should a write it? return Database.query('SELECT Id, Name FROM Stereo_System__c' + ...
user avatar