Questions tagged [dml-operations]

Use Data Manipulation Language (DML) statements to insert, update, merge, delete, and restore data in Salesforce.

Filter by
Sorted by
Tagged with
10
votes
2answers
3k views

How to call a standard controller action of a VF page from a VF component

I have a visual force page as follows which includes a component call Example one, Component has a command button and I want to call the standard controller save action of VF page from the VF ...
3
votes
0answers
104 views

DML takes long time on custom object with no triggers/WF/PB on it

I've got a code, where on lead insert, I also insert 1 record of custom object Demand_Funnel__c. Demand_Funnel__c has no apex triggers, no WF rules, no Processes tied on it. If it's a first lead ...
2
votes
2answers
465 views

DML Statement vs. Database method with true parameter?

Database methods with a true parameter will work same as DML statements. It won't allow partial DML operation in Apex Why are we still using DML statement, when we can achieve the same functionality ...
2
votes
3answers
882 views

Partial insert of more than 10000 records

What happens when we use Database.insert to insert more than 10000 records with allOrNone set to False? Are only the first 10000 ones inserted?
2
votes
1answer
256 views

DML operations in the Apex callback method

An apex method that returns a continuation object can’t perform DML. The solution given by the Salesforce developer documentation is the “perform DML operations in the Apex callback method”. https://...
1
vote
1answer
464 views

Does Apex wait before moving onto next line

Gentlemen, simple question. Does Apex wait for the DML operation of inserting accounts to complete before moving onto the next line (SOQL statement)? insert parentAcctList; List<Id> acctIdList ...
1
vote
1answer
446 views

How could I test a BusinessHours class functionality with unit tests [duplicate]

I am trying to write a unit test for the following method, public static DateTime addBusinessDays(DateTime startDate, Integer numberOfDays, String businessHoursName){ Integer ...
1
vote
1answer
347 views

DML is NOT Recommended in APEX Property Setter

I just got a strange recommendation from SalesForce support which was related to inability of APEX controller class to save value from VisualForce component to a custom setting. The recommendation ...
1
vote
1answer
97 views

UserAccountTeam - Test Class

I have a trigger that basically replicates adding the default team to the account team (it's doing more than just that but for ease of asking this question lets leave it at that case). How would one ...
0
votes
1answer
286 views

MIXED_DML_OPERATION on closing tasks upon user deactivation

I created a trigger that queries and deletes all related tasks once a user in deactivated. and I am getting this frustrating error. "MIXED_DML_OPERATION, DML operation on setup object is not ...
0
votes
2answers
287 views

More than 100 Api Calls and Insertion of More Than 1000 Records

I have an apex class that is going to make more than 100 api calls to an external resource to get more than 10000 records for insertion into Salesforce. What should I use to get around this? I ...
0
votes
1answer
57 views

How to create ongoing log of database actions on Custom Object records?

Context: A specific kind of sObject which is the detail in a master-detail relationship is getting mysteriously deleted across a number of different Master records. I have been trying to narrow the ...
0
votes
1answer
55 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?
0
votes
2answers
174 views

do I need to update or insert a list, set or map in testclass

When ik create a list, set or map and add records to these do I need to update / insert after adding records. I did a test system debug on a testclass with only a return. My debug returns a list with ...
0
votes
1answer
467 views

Merge Contacts through API Endpoint (3rd Party App?)

My understanding (after googling this intermittently throughout the last 12 months and vainly hoping the answer to be different each time) is that there is no Salesforce API Endpoint that a user could ...
0
votes
1answer
635 views

How do I advoid mixed dml operation creating user for community

I am trying to create a list of contacts and add these to the community as users. I keep getting the error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have ...
0
votes
1answer
425 views

Before Insert Trigger Not Deleting The records

Here's the scenario: I've a custom object (ObjectA__c) with only one custom field Email_Address__c (which can be unique). Now I would be inserting new records using Data Loader such that: 1) If ...
0
votes
0answers
24 views

Database.Upsert operation says field doesn't exist, when it exists

I have a custom object named MDU_Squad to which I insert records using the Data Import Wizard. I have set 2 external ID fields in there, which are Street_address [duplicates allowed] CIty_Name [...
-1
votes
2answers
105 views

DML exception on seemingly not involved object?

Apex trigger TF_UserTrigger caused an unexpected exception, contact your administrator: TF_UserTrigger: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on ...
-2
votes
3answers
775 views

Can I throw custom exception inside a loop?

I've created a custom exception class by extending Exception {} my question is, can I throw a custom exception inside a loop. does Apex consider throwing a custom exception as a DML operation Below ...