2022 Developer Survey is open! Take survey.

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
-3 votes
1 answer
237 views

Creating a 100K records in Account salesforce object using apex code [closed]

I am trying to create an 100K Account records in my salesforce org using apex code in developer console, I managed to create till 1000 by this apex code. List<Account> list1 = new List<...
user avatar
  • 1
0 votes
1 answer
123 views

Updating objects with SOAP API

I've set up a chat for my Salesforce Org and I want to change the chat capacity through code. From the Salesforce documentation (see documentation) it is possible to update the PresenceUserConfig. I ...
user avatar
  • 41
0 votes
1 answer
106 views

Writing test class to change Inactive User to Queue

I'm a beginner APEX developer in a bit of a tricky spot. As we know, leads get assigned to sellers. However, sellers get fired from time to time causing them to become inactive users. The issue then ...
user avatar
0 votes
0 answers
48 views

Trying to insert 2 records in 2 custom objects which AREN'T in a Relationship via Lightning Aura Component

I am trying to create a record in 2 objects at a time. Object 1 = Guest_Master__c Guest ; its fields =Guest_First_Name__c, Guest_last_name__c, Guest_email__c, Guest_phone__c. Object 2 = ...
user avatar
0 votes
0 answers
278 views

Batch Apex Class with HTTPCallout to Insert New or Update existing records

I'm struggling to make this work. I'm a very beginner developer and really need some help. I need to connect to an external system, get the Contacts from a list and create new Leads in Salesforce. In ...
user avatar
0 votes
0 answers
39 views

Transaction Security Policy - Stop connectors(Data loader, Excel connectors, workbench, etc.. ) to do DML in salesforce

I got a requirement where I need to stop my users to perform the update, insert, and upset from any connector(Excel connector, workbench, data loader, etc..) even if they have access in the profile. I ...
user avatar
0 votes
1 answer
233 views

Upsert DML Operation

Consider the below code. I thought the way upsert DML works is that if it sees that there is a new record with matching key (here in this case there is already an account with Name = Acme and ...
user avatar
0 votes
1 answer
65 views

DML in trigger succeeds, but records are not created/available

We have a Trigger Handler which calls on "after update" a method "CreateNewRecords". public without sharing class sObjectTriggerHandler { public static void handleAfterUpdate(...
user avatar
1 vote
1 answer
181 views

MIXED_DML_OPERATION : Can not insert a user record from account trigger even when User Role is null

I am trying to create a community user in an after update trigger of account. I am setting the UserRoleId = null but still am getting MIXED_DML_OPERATION exception. As per documentation: You can ...
user avatar
  • 2,450
0 votes
2 answers
94 views

Audit log of who/what creates new records

There are concurrent creations of multiple records happening in the org. We want to track the creation of record(standard/custom sObject). We also want to see which user is creating/updating that ...
user avatar
  • 15
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
2 votes
1 answer
749 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://...
user avatar
  • 41
0 votes
2 answers
934 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 ...
user avatar
  • 2,068
-2 votes
3 answers
2k 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 ...
user avatar
0 votes
1 answer
761 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 ...
user avatar
  • 543
0 votes
1 answer
1k 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 ...
user avatar
  • 2,068
-1 votes
2 answers
186 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 ...
user avatar
  • 239
1 vote
2 answers
455 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 ...
user avatar
0 votes
1 answer
933 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 ...
user avatar
2 votes
2 answers
694 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 ...
user avatar
4 votes
0 answers
156 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 ...
user avatar
  • 1,031
3 votes
3 answers
5k 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?
user avatar
1 vote
1 answer
434 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 ...
user avatar
  • 237
1 vote
1 answer
163 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 ...
user avatar
0 votes
1 answer
395 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 ...
user avatar
  • 101
2 votes
1 answer
794 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 ...
user avatar
0 votes
1 answer
63 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 ...
user avatar
  • 543
10 votes
2 answers
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 ...
user avatar
  • 1,995
1 vote
1 answer
712 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 ...
user avatar
  • 1,995