Questions tagged [database.insert]
The database.insert tag has no usage guidance.
34
questions
-1
votes
0
answers
20
views
Incorrect owner for opportunity while converting lead
I am using an Omniscript -> Integration Procedure -> Dataraptor-> database, call to convert a lead to an account, and do some processing, like create opportunities, generate pdfs etc.,
When ...
1
vote
1
answer
121
views
Return Database.SaveResult when allOrNone is set to true
I have a specific use case where I would like to insert records with:
List<Database.SaveResult> srList = Database.insert(contacts, true);
But also to get that SaveResult returned and to be able ...
0
votes
1
answer
118
views
rollback partially in Service
When we are using Database.insert() or Database.update() with a false option(In any service) then it returns a success or failure result. We know in the insert if any lines fail, delete the header and ...
0
votes
1
answer
258
views
Database.insert() for single sObject not returning an array of Database.SaveResults
The SFDC documentation says for Database.insert: "If only one sObject is passed in, the SaveResult array contains a single element." However, in my testing, if you pass in a single sObject, ...
2
votes
1
answer
1k
views
Not able to insert parent and child record using database.Insert in one go
In my case eSales_Order__c is the Parent object and having Master detail relation ship to eSales_Order_Line__c. So I am trying to insert into both Parent and child at same time . I am having a common ...
-3
votes
1
answer
47
views
Integration of salesforce for file uploads and insert [closed]
Is there any way to upload, insert files from any excel sheets(google sheets, MS,...) into salesforce records?
0
votes
2
answers
58
views
I want to insert multiple Account Records with visualforce but i am getting error(Formula Expression is required on the action attributes.)
//My visualforce page code
<apex:page controller="AddMulAccountContr" >
<apex:form >
<apex:pageblock >
<apex:pageblockTable value="{! listaccount}&...
0
votes
1
answer
96
views
upsert operation using IdLookup
I want to perform insert and upadate operation on Account on same record by using following query but It inserts two accounts with different descriptions
Account acct = new Account(Name = 'practice ...
0
votes
0
answers
527
views
Importing data in a data extension and avoiding errors
When we define a data extension in Marketing Cloud with two fields:
Email (254)
Company (50)
If we try to import records with "Company" values that includes length of 50 or under and some ...
1
vote
1
answer
1k
views
Get all the Ids that were inserted by Database.insert - without iterating each record
We are using the Database.Insert(leads, false);
We want only the the ids that where insert. We have a lot of leads to be checked if we use
for (Database.SaveResult result: results) {
if (result....
2
votes
1
answer
199
views
Unexpected behaivor: Database.insert(userList, false) is rolling back User insertion
I am attempting to insert two users with the database.insert method. One user that should work, and another that is missing required fields.
// Create two users, one of which is missing a required ...
2
votes
1
answer
544
views
Salesforce Relational Database ACID
I was reading about relational databases and found that Salesforce is built on Oracle's Relational Database. Based on my understanding, Relational Databases "promise" the following ACID principle:
...
2
votes
1
answer
149
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 ...
2
votes
1
answer
340
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
1
answer
470
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 ...
-2
votes
1
answer
953
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
1
answer
88
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
0
answers
495
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
1
answer
645
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
1
answer
1k
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
0
answers
570
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
1
answer
32
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
2
answers
2k
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
1
answer
3k
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
1
answer
2k
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
3
answers
2k
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 ...
1
vote
1
answer
588
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
2
answers
594
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
2
answers
131
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
1
answer
75
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
2
answers
470
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
1
answer
3k
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
1
answer
53
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
3
answers
44k
views
Database.insert(list,false) in apex [duplicate]
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 ...