Questions tagged [database]

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

Filter by
Sorted by
Tagged with
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 ...
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> ...
1
vote
2answers
1k views

Salesforce DB connect with SQL Management Studio

I'm trying to connect SQL Server Management Studio to Salesforce so I can see tables and columns but unable to connect. Do I need any ADO.net connector or Salesforce plugin for this to work? Do I need ...
-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?
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 ...
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 ...
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 ...
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,...
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 ...
0
votes
3answers
138 views

Salesforce database : how does it work

I don't really know how to ask that question, in Salesforce we have objects, and if I want to update some object (for example) I use an soql query like Account a = [select name from Account where id ...
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
1
vote
1answer
3k views

ExactTarget | Quering users from multiple Data Extensions

I'm trying to get a query on several fields that are in 2 Data Extension Tables (the matching content is SubscriberKey). I'm familiar with SQL, but I used it primarily creating lists in Oracle's ...
0
votes
1answer
432 views

Database Class and DML in a transaction

According to the official document - https://developer.salesforce.com/docs/atlas.en-us.198.0.apexcode.meta/apexcode/apex_transaction.htm I understand that if there is any error in a transaction ...
0
votes
0answers
72 views

Problem with database.query() in APEX REST @httpput method

In APEX REST @httpput method, after DML is done on newKas, saved record having different value in Article_Title__c instead of fetched article title field value from database.query() method. @HttpPut ...
1
vote
1answer
172 views

Is there a tool to view an organisation's schema outside Salesforce? [duplicate]

For example, if I want to have an image with all the tables and relationships in my organisation, I would have to manually look for every object/field/relationship and build it myself in an external ...
0
votes
1answer
39 views

Is it possible to generate Leads from my database

I am using a form on my site to add new leads to a MySQL database. Is it possible to generate my leads in Salesforce from my existing database?
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 ...
2
votes
2answers
1k views

How to remove deleted records from salesforce database memory?

3 days back I have created a report in my org and after some times I deleted that record ..even i deleted report from recycle bin as well Now it's been 3 days still that report present in salesforce ...
0
votes
1answer
94 views

Using created records to generate Attachments on the same call

I am creating records and using these records to create PDF Attachments (both are happening in the same call). As shown below: List<ResellerRevenue__c> resellerRevenues = new List<...
1
vote
2answers
611 views

Put value of a field other than ID from list to set

Below trick works for only ID field, but if I need a field other than ID field? List<SObject> results = Database.query(someSOQL); Set<Id> resultIds = (new Map<Id,SObject>(results))....
0
votes
3answers
660 views

Translating Data using Apex Triggers

I am trying to import a database that have numbers in the picklist value. (1,2,3,4,5..etc) However, in the user-end, they should see different set of values, for example ( 1.-> Partner 2.->LLC ...
0
votes
1answer
111 views

Data backup in salesforce

Data backup in salesforce I need to develop an Apex script to backup all the database data every day. Is there an optimal way to do that? What could be needed to be done if pictures or pdf files are ...
2
votes
0answers
143 views

Salesforce Optimistic Record Locking and JavaScript Updates

Is there a way to implement field only updates for Salesforce? Even if fields could be updated concurrently through JavaScript/JavaScript remoting calls, would Salesforce still save the record using ...
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 ...
0
votes
1answer
115 views

Java - like Apex for SOBJECTS

Sorry, I don't know if this is a proper context to make this question, but I don't know where to make this question. I write here because I immagine that a lot for today apex programmers has been ...