Questions tagged [database]
208
questions
0
votes
1
answer
46
views
Any suggestions on better or optimized approach that returns single row from multiple rows based on ROW_NUMBER in SFMC
I have a customer data extension where customer records are saved with order numbers like this:
CustomerOrderDE:
CustomerID
OrderID
OrderTotal
1
101
$100
1
102
$200
2
103
$50
3
104
$75
3
105
$60
...
0
votes
0
answers
47
views
Tip still showing Database access elements in loop
I have a loop in a flow where I have multiple Get elements which are clearly placed after the "After Last" path when the loop is complete. But the Flow 'Tips' is still telling me almost ...
2
votes
0
answers
64
views
"Didn't understand relationship 'Histories' in FROM part of query call." When query Seller History from Seller
I am getting an script-thrown exception when query Seller History from Seller. Here is my apex class:
public without sharing class MainLayoutController {
public static SObject ...
0
votes
1
answer
87
views
Database delete isSuccess is true but record not deleted [closed]
I've been trying to remove related record called it A before inserting record B on trigger. In the handler i was querying record A by value populated in record B field. When i called result and debug ...
0
votes
1
answer
68
views
How to get records from sendable audience who did not make it to _SENT log without hardcoding the jobid
I have a DE extension where I have saved 1 record by querying:
DE NAME: DataView_Job_DE
Select top 1
JobID
,EmailName
,CreatedDate
,JobType
,JobStatus
,Row_Number() OVER (Partition by jobid ORDER BY ...
0
votes
1
answer
128
views
How to selecting value from another data extension in select statement in SFMC
I have a DE extension where I have saved 1 record by querying:
Select top 1
JobID,
EmailName,
CreatedDate,
JobType,
JobStatus
from _job
Output is saved in data extension: DataView_Job_DE
Now, I am ...
0
votes
1
answer
170
views
Possible to remove or ignore errors from trigger-context SObject after .addError() in Apex?
With Apex, after calling .addError() on a trigger record is there any way to subsequently remove that error such that the DML operation will complete successfully?
I don't see any Database methods (...
0
votes
0
answers
37
views
Why won't Heroku let me upgrade to a database plan above Basic?
Despite having recently upgraded to Professional dynos on Heroku, I still only seem to have the option to upgrade my Mini postgres DB to Basic -- no other choices. I've been searching around to try to ...
0
votes
1
answer
124
views
Parentheses on Dynamic SOQL Unexpected Token '('
I still dont get to know why this dynamic query executed through Database.query() is throwing Unexpected Token Error on the parenthesis char. My code so far is this:
@AuraEnabled
public static ...
0
votes
1
answer
177
views
How to apply inclusion and exclusion criteria when data extensions are linked by one to many relationships?
I have a contacts DE table like this:
Contacts
CustomerID
CustomerName
Country
1
Alfreds Futterkiste
Germany
2
Ana Trujillo Emparedados y helados
Mexico
3
Antonio Moreno Taquería
Mexico
4
Around ...
0
votes
1
answer
112
views
Create a global number sequence for Lead and Account
I want to create a global numeric sequence that works for both the Lead and Account object, because we will integrate Salesforce with an ERP that works with leads and accounts in the same object, ...
2
votes
0
answers
221
views
Where is Database.query() spending (so much) CPU time?
My assumption was that only Apex Code is using CPU time. But the what I measure for code that is run by Salesforce's own Backend code speak a different language.
List<SObject> result = Database....
0
votes
0
answers
166
views
Implementing autocomplete suggestion for record ids
The LWC app that I am currently working on has a feature that lets users fetch information for a record whose record ID is entered. I am looking forward to implementing a feature that proactively ...
-1
votes
1
answer
81
views
Trigger action values not updating in Database
I am new to salesforce and trying to play around with triggers. I have tried the trailhead exercise for triggers to set shippingPostCode from BillingPostalCode. Below is my code
trigger ...
-1
votes
1
answer
83
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 ...
0
votes
0
answers
471
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 ...
0
votes
1
answer
1k
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 ...
0
votes
2
answers
648
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 ...
4
votes
0
answers
389
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 ...
0
votes
1
answer
1k
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 ...
0
votes
2
answers
108
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 ...
0
votes
1
answer
926
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 ...
1
vote
0
answers
220
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 ...
1
vote
1
answer
795
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 ...
0
votes
1
answer
272
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 ...
-2
votes
1
answer
104
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 ...
0
votes
1
answer
26
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.
2
votes
1
answer
2k
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 ...
0
votes
1
answer
981
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 ...
0
votes
2
answers
678
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 ...
0
votes
0
answers
78
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?
0
votes
1
answer
36
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 ...
0
votes
2
answers
492
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 ...
4
votes
3
answers
3k
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.
...
0
votes
1
answer
351
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 ...
1
vote
0
answers
290
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 ...
0
votes
0
answers
39
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 ...
3
votes
2
answers
751
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 ...
1
vote
0
answers
42
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 ...
0
votes
1
answer
281
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 ...
2
votes
1
answer
212
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 ...
0
votes
2
answers
197
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 ...
1
vote
0
answers
258
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 ...
0
votes
1
answer
212
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 ...
3
votes
0
answers
612
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 ...
3
votes
1
answer
1k
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 ...
1
vote
1
answer
480
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 ...
1
vote
1
answer
2k
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 ...
3
votes
2
answers
770
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 ...
2
votes
1
answer
542
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:
...