Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
51 views

Need to retrieve values from database without refreshing the entire page

I have a Visualforce page with picklist and associated fields with it. When the picklist value is no I want the other input field values that we have provided to be saved in the database after ...
10
votes
4answers
22k views

Only variable references are allowed in dynamic SOQL/SOSL

I'm trying to re-request an Asset from the database: asset = Database.query('SELECT ID, Price, Asset_MRR__c FROM Asset WHERE id =: ' + asset.id + ' limit 1'); But I get an error: Only variable ...
1
vote
3answers
151 views

Help Schedule email reminder

Im new in salesforce apex programming.. I want to make an email reminder if case status != closed to case owner H+5, H+7, and H+10 .. H = created date .. how do i get the owner email value? and ...
2
votes
2answers
4k views

Pulling data from data views for one business unit only using query

SO, I want to pull data from data views for our business unit only in marketing cloud. Currently, it seems like when I run a query something like: SELECT * FROM ent._Subscribers WITH (NOLOCK) It ...
3
votes
1answer
2k views

Difference between Database.executeBatch vs System.scheduleBatch

I am curious to know is there any notable difference between Database.executeBatch vs System.scheduleBatch. One difference I know is, we can delay the batch execution in scheduleBatch method. However, ...
7
votes
2answers
10k views

updating a records using external Id in Apex

I copied the product data to another object named foo. I used only the name and externalId of product to copy it to Foo object. Foo's external id matches with product's external Id. Some of my ...
2
votes
2answers
2k views

Is it possible to not use an ExternalId field for Database.Upsert?

I'm trying to upser a list of Asset records via Database.upsert(List, externalIdField, boolean) and on the externalIdField, I want to pass the standard field 'SerialNumber'. List<Database....
0
votes
1answer
627 views

How to get the Id of Inserted records from Database.Upsert? [duplicate]

I'm having this dilemma regarding the result for Database.Upsert(List, boolean). Database.Upsert returns Database.UpsertResult and it provides as the Id of the record that was successfully inserted/...
0
votes
0answers
84 views

Exception: Invalid field X__c for SObject Y__c

I have below VF Page. <apex:pageBlock > <apex:pageBlockTable value="{!CPAT_accounts}" var="c"> <apex:repeat value="{!excelFields}" var="f"> <...
1
vote
3answers
579 views

How to identify records “actually” getting updated?

We have a SAS Datawarehouse system in our project that polls records daily from Salesforce to support data archival process. However, they have started complaining that the "updated" Account records ...
0
votes
2answers
239 views

Get slow running SOQL information from production

Since Salesforce underlying data layer uses oracle database, can we get information on Slow running SOQL’s in production with times that we can target to improve? Any indexing advice from salesforce ...
0
votes
1answer
104 views

How to access SOQL query results

I have a table that I'm querying using SOQL and the query results should contain multiple rows. I'm trying to iterate through the query results and access attributes from each row of the query ...
0
votes
1answer
5k views

Database schema export

Hi we have a date export made from salesforce instance. We'd like to rebuild just the database but we stumbled on process to import the CSV files to a SQL Server database. We have force.com IDE ...
3
votes
0answers
79 views

First event/event relation insert taking a while

I have an application that inserts events and event relations in an org's database and has a loading icon to prevent the user from doing anything until the event and relations are properly created and ...
1
vote
1answer
27 views

How do I create a related field in Products2 to Documents.Id?

I am trying to pull in Document images to display on product listings (Product2 object) and wanted to just create a related lookup field to the Document Id. The image is displayed by a formula/text ...
1
vote
1answer
685 views

Prevent CRUD Delete/Insert/Update Checkmarx Issue for SObject in Apex Code

I am using Database methods for DML on SObjects. I am getting CRUD Delete issue in CheckMarx security scanner for below line: public SObject toDML; Database.delete(toDML, false); Can anyone help ...
2
votes
1answer
566 views

Database.Query Variable Does Not Exist

How can I get the field results from a dynamic database query to be available to be put into a list? Here is the code I have: //Query on the destinationObjectFieldName results List<sObject> ...
-2
votes
1answer
375 views

What is the execution time spent in the database for an DML or SOQL or SOSL?

Is it possible to find the execution time for a DML or SOQL or SOSL? What are the factors on which the execution time of these queries depend?
1
vote
1answer
809 views

Salesforce callout to update external MySQL database

My desired end result for this project is when a lead record is converted to person account, an HTTP callout will be made to update and external MySQL database. My initial approach was to utilize ...
3
votes
2answers
150 views

Links to Documentation for Database.* DML Method? Gone from APEX Docs

So we've got the usual DML statements insert accts; and we've got the database class dml statements, e.g. Database.insert(accts, false). Had a team member ask me a question about the parameter ...
2
votes
1answer
744 views

DML Database method is covered by unit tests, how to determine reason for no test coverage of the SaveResult variable?

The blue indicates test coverage. The red indicates uncovered code. Where would I find the cause for the uncovered code? public List<Opportunity> insertOpportunityAndDefineRelationships(...
1
vote
1answer
1k views

Error when calling Database.insertAsync (Status Code “ASYNC_OPERATION_LOCATOR”)

I am experiencing some bizarre behaviour when trying to insert external objects. The following statement results in an error: Object__x o = new Object__x(Name__c='Test'); Database.SaveResult[] sr = ...
0
votes
1answer
198 views

How our database should be for using it with Salesforce Connect?

I have a on-premise data base(Oracle DB), this database i need to use in salesforce directly using External Object technology provided by salesforce. I understood how to use External objects in ...
0
votes
2answers
105 views

Rolling back a complete transaction

I have two object foo__c and zoo__c. zoo__c is a child of foo__c with a master detail relationship. I have validation rule created on Zoo__c with a condition that when the status__c field on related ...
0
votes
1answer
155 views

How can I find out what fields made my upsert fail?

I'm trying to upsert some records. I use Database.upsert. If the failure is related to a duplicate value (external ids that have to be unique) I need to know what fields are duplicate and clear (...
1
vote
1answer
28 views

Compile Error on batch class to fetch fields from saveresult

I have below code to fetch field values from records of Database.Saveresult. I am getting error as below. Error Expression of type Database.SaveResult has no member named Territory_Name__c Code ...
1
vote
1answer
91 views

Apex to run cross-object duplicate detection (Leads vs Contacts)

I have the following code that checks Phone, Phone2 and Mobile for Leads and gives an error if a Lead with the same phone exists, before saving the new record. How do I turn it into a code that will ...
25
votes
3answers
7k views

Can I prevent an insert to be rolled back even if my class (later) runs into an exception?

I do some custom logging in my code which basically means I write and update sobject records that contain custom log information. The problem is whenever an exception is thrown in my class the ...
0
votes
1answer
491 views

What are the implications of trying to modify a rollup summary field?

I have tried manually modifying it and it seems possible, but I am not sure if there are any unintended side effects. My requirement is to have a logging summary table that rolls up the details of ...
1
vote
1answer
875 views

Accessing ALL SUBSCRIBERS in a Parent BU from a Child BU?

I have two child BUs and as people are deployed they are added to the ALL SUBSCRIBERS list. Their STATUS is limited to the Child BU, so an unsubscribe occurs only at the child BU. Question: If a ...
0
votes
1answer
286 views

How to format a number with comma?

Currently, I am using this query SELECT top 10 snt.Domain, count(*) AS DomainCount from _Sent snt group by snt.Domain order by count(*) desc The data type of "DomainCount" is number and the ...
1
vote
2answers
7k views

Using query for a specific date

I am trying to pull data from SENT data view based on date. What format of date should I use? I have tried this but no results: SELECT * FROM _Sent WITH (NOLOCK) WHERE EventDate = '2017-05-29' I ...
0
votes
1answer
27 views

Which is the default field on which operates Database.Update?

I just couldn't find any topic regarding on which Field the Database.Update will operate? I suppose that it will do the update on id but I'm not sure. Am I right?
1
vote
2answers
798 views

Storing time-stamps with millisecond precision

When you have automated processes interacting with your system, it is very common for multiple things to happen within the same second. In order to prove that these events happened in the correct ...
1
vote
2answers
2k views

Database.update() is not updating the data, but there are no error message

I am experimenting this to test Database.update() to update data partially in Developer Edition. The issue is that, it is not updating the data and is not throwing any error. I am certain that, there ...
0
votes
0answers
71 views

why database.emptyRecycleBin() not removing the actual record from bin? [duplicate]

database.emptyRecycleBin([select id from test__c where IsDeleted = true ALL ROWS]); when i run the above and try to query the bin record, still record exist. What is wrong ? Please guide me !
0
votes
1answer
99 views

Understanding Salesforce user database

I wish to know how Salesforce designs their Multi-Tenant database. My questions are as follows: Is every tenants and users stored in a central master user database? Does every tenant have their own ...
1
vote
2answers
153 views

Prevent insert if object in list is not valid and find which record is invalid

I am developing lightning component, on which user enters data in table and creates multiple records. If some records do not pass validation - row has to be highlighted with red. For this I need to ...
1
vote
2answers
1k views

Partial success for insert, update, delete [duplicate]

Not long time ago I decided to use insert, update, delete methods of Database class and its optional 2nd parameter allOrNone with false as value. But I found calling getId from the result does not ...
1
vote
1answer
42 views

Multiple Databases On Salesforce DE edition

I was wondering whether it is possible to have multiple databases associated with my current Salesforce DE account. As I want to add some new data, but do not want to corrupt the current database ...
2
votes
1answer
142 views

Update existing class to implement Database.Batchable

I'm trying to figure out how best to modify an existing Apex class to implement the Database.Batchable interface. I currently have two classes: CustomerInfoUpdater - this class is void and is ...
2
votes
1answer
356 views

SELECT ActivityHistories For Any SObject

I am writing a code which supposed to process a list of ActivityHistories for any SObject which supports them (like Opportunity, Account, etc). And at that point it's impossible to know what is the ...
1
vote
1answer
66 views

can anyone suggest good document to learn batch apex? That has in depth details about all database class methods?

I have looked through several blogs and couldn't find a detailed document that includes all methods of Database class. I could only get detail of start, execute and finish. I am interested in details ...
0
votes
1answer
1k views

Get field values of newly created record other than Id

Is it technical feasible to obtain fields like OwnerId, Name from newly inserted record from database.Saveresult? Apex code: for(Database.SaveResult sr: srList){ if (sr.isSuccess()) { Id ...
0
votes
3answers
50 views

Move update out of loop and use system method

I have a simple trigger to update standard Account field from custom field (b/c of Lead conversion mapping limitations). I want to move the update out of the loop and use a database.update(newAccount,...
11
votes
6answers
7k views

Printable ERD from Salesforce that you can Edit

I built a solution for a customer and I want to pull the ERD from the Salesforce instance and have the ability to edit it. I know there are a few tools and the Schema builder in Salesforce but none ...
1
vote
1answer
386 views

System.TypeException: Invalid conversion from runtime type List<Territory> to List<UserTerritory>

I have below code that throws exception as mentioned in subject. Error System.TypeException: Invalid conversion from runtime type List<Territory> to List<UserTerritory> Apex class code ...
0
votes
1answer
454 views

Variable does not exist: portalUserInfo.conAccount.Id in Query

Please help with this error: String query = 'SELECT Project__c,' + ' Project__r.Testing_Submitted__c,' + ' Project__r.Project_Sub_Phase__c,' + ' Project__r....
3
votes
3answers
974 views

Database DML method executes twice in any record has been failed

I've been trying to leverage custom roll up functionality and found that Database methods is perfoming dml twice. First time it's inserting/updating all records and second time only ones that can be ...
1
vote
1answer
41 views

Is there is any way to count number of child objects of account object

I used related list but in related list I have to call the related object which I know but if there will be an custom object then what to do