Questions tagged [database.insert]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1
votes
1answer
50 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
28 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
22 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
39 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
74 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
53 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
180 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
325 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
177 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
579 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
45 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
82 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
87 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
56 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
86 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
733 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
38 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 ...
0
votes
3answers
9k 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 ...