Questions tagged [database.insert]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
35 views

Not able to insert data successfully

I am trying to create a lightning component through which I would be able to insert both Account and Contact data together. But I am not able to do so. Can anyone kindly let me know why this is ...
1
vote
1answer
27 views

How to determine when retry attempt is happening with allOrNothing

We have code using the Database.insert/update(records, false) syntax. I know how to handle the errors after the fact, so that is not the issue, but when using static recursion flags, the first attempt ...
0
votes
1answer
53 views

Database.update is not working as expected

I am trying to write a code which will query account records and lock them using FOR UPDATE keyword and then I am also triggering another batch which will try tu update same record with some more ...
-1
votes
1answer
63 views

Database.Upsert not able to prevent AllOrNone

Elaborating the Question:- We have 3 Objects, Branch, Account and Branch Accounts, Branch Accounts is a junction between former 2. Now we are trying to insert Branch Account records via Batch, and in ...
0
votes
1answer
31 views

AuraEnabled returning success records instead of failed records

I have apex AuraEnabled function which is inserting records for a junction object, however due to some validation rules, some of the records may get failed. So I have a solution to maintain a list of ...
0
votes
0answers
28 views

Test Class - SOQL in Test Returns No Results using Database.Insert(RecordList,DML), but works using Database.Insert(RecordList)?

I am creating test coverage for a new Lead Process we've built for our company. To properly test this deployment, I need a list of Leads to show as being Inserted by our Pardot API connector user, and ...
2
votes
1answer
51 views

How to throw or cause an Access Level exception in a test class

anyone know how to throw an access level exception in a test class to cover the below code sample? I'm assuming the object being inserted with Database.insert needs to have sharing settings modified ...
1
vote
1answer
153 views

Database.insert(list, false) run trigger twice? [duplicate]

Example: If we are inserting 10 records in an object, Where 5 records are correct and the remaining 5 records are incorrect. • In Database.insert 5 records will be inserted, remaining 5 records ...
0
votes
0answers
92 views

@future method not getting called from catch block

I am calling a webservice (synchronous) and in case of CalloutException, I'm trying to create an error log in a custom object. The problem is, the record insertion is happening in a future method and ...
1
vote
1answer
23 views

Record Insertion using Lightning,

I need to insert a record to a custom object throught the lightning page that I have created. but i am getting the attached SS error. Could any1 tell me what I am doing wrong ? CMP:- <aura:...
1
vote
2answers
306 views

Does Database.SaveResult, Database.DeleteResult, etc. implement a public interface?

The various DML operations (insert, update, delete, etc.) all return results with very similar methods and properties. It is not uncommon, as a developer, that I should want to handle these results ...
0
votes
1answer
803 views

How to avoid: Error uncommitted work pending in my testclass

I am doing do a callout trough a processbuilder with a future call. Before I do the call I get some variables from a custom setting. When I do an insert in my testclass for my custom setting I get the ...
0
votes
1answer
278 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/...
1
vote
2answers
729 views

Sending Email to Queue Members On Lead Creation Without Using Assignment Rules

I have 2 Users that belong to the queue 'Sales' with the Send Email to Members checked. I have an online app that creates a new lead, and sets various lead fields, but the email is not sent to ...
0
votes
1answer
61 views

Duplicate ID in list causes whole UPDATE to fail although allOrNone is set to false

A duplicate ID in my list of SObjects "businessPartnerListToUpdate" Database.SaveResult[] saveResultList = Database.update(businessPartnerListToUpdate, false); causes an Exception to be thrown: ...
0
votes
2answers
84 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 ...
1
vote
2answers
89 views

pageMessages should ignore Database.insert(records, false) errors

I am creating some records in my controller but some of them might fail during insert due to duplication, so I use Database.insert(records, false). It works just fine and ignores records that already ...
2
votes
1answer
57 views

How to create cascading objects while offline with SmartStorage and the mobile SDK

Do you have any ideas how to create cascading objects (e.g. create a new Soup A entry that contains an also new Soup B relationship entry) while in offline modus and using the SmartStorage of the ...
1
vote
2answers
109 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 ...
0
votes
1answer
899 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
1answer
39 views

saving skipped record detail

I am creating List of Accounts, using database.inser(list,false) if i did give name for record in list,it will skip that particular and insert remaining records, is there any chance to get the details ...
1
vote
3answers
12k views

Database.insert(list,false) in apex

I am creating List of Accounts, using database.inser(list,false) if i did give name for record in list,it will skip that particular and insert remaining records, is there any chance to get the details ...