We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [insert]

Using insert DML, you can insert new records and commit them to the database.

Filter by
Sorted by
Tagged with
0
votes
1answer
11 views

Market Development Funds Objects - Setting OwnerID on Insert [on hold]

The following objects do not allow for the OwnerId to be set on Insert via Apex. PartnerMarketingBudget PartnerFundAllocation PartnerFundRequest PartnerFundClaim
1
vote
1answer
22 views

Inserting dependent objects without using a loop

I have this issue. I have a list of Contracts and I need to create Cases and custom objects called 'Budget' that the Case needs to lookup. The code can be summarized to something like this for(...
1
vote
1answer
58 views

Upserting records using SFDX CLI for a object with no External Id

Below are the available data related commands in CLI. If I want to insert records using SFDX CLI, how to do that? force:data:bulk:delete -- bulk delete records from a csv file force:data:bulk:...
0
votes
0answers
28 views

simple_salesforce bulk insert - Duplicate Id error

I am using the Python package simple_salesforce to bulk insert instances of a custom object. The custom object has Account Id as a foreign key, which I am inserting during the bulk insert. I'm seeing ...
0
votes
1answer
67 views

simple_salesforce - Cannot bulk insert more than 10 records at a time [closed]

I am using the simple_salesforce Python package. I tried bulk inserting 100 records using bulk.insert(), and did so without any errors. However, when I checked how many records were present after, ...
0
votes
0answers
102 views

System.TypeException: DML operation INSERT not allowed on __Share

I have created share object in my salesforce environment. From Setup-> security Controls -> Sharing Settings -> I made my custom object access to "Private". So suppose my object name is EVT_Client__c ...
1
vote
2answers
52 views

Apex Test class for web-to-lead creation without OwnerId

I need to create an Apex test class for a Lead Apex Trigger that handles "before insert" of the web-to-lead inserts of Lead records that DON'T have OwnerId at the "before insert" time. Assigning of ...
-4
votes
1answer
74 views

Trigger not creating a new record [closed]

If case status got change for certain record type, new support record should get created. I configured status and record type combination in custom setting I am trying to avoid nested loop in my ...
0
votes
1answer
30 views

Trigger.new information; Insertion of new Contact

I have a trigger that on contact creation/insertion, I need to get its ID and make a new task associated with that ID. However, I have System.debugged Trigger.new, and I see that the newly created ...
0
votes
2answers
37 views

How to insert more than one record from visualforce page to custom object?

I want to insert the records in a custom object. The code is working fine when I insert one record at a time but when I am trying to insert more than one record on a same run one at a time than it is ...
-2
votes
1answer
46 views

Getting Unexpected Token error when inserting records from execute anonymous [closed]

Custom_Object__c co = new Custom_Object__c(Name='TEST', Date_of_Visit__c=2019-06-06); insert co;
1
vote
1answer
77 views

Insert Case Apex - Disable Active Assignment Rules

I am trying to insert a case in apex and set the owner to a specific user id. However active assignment rules are rerouting the case. In apex, how would I disable the use of active assignment ...
0
votes
1answer
56 views

List.clear() not emptying my List

The project that I am working on has an API endpoint that is meant to upload a large number of records into three different tables: Careers, Degrees, and CareerDegreeRelationships. The endpoint is ...
0
votes
0answers
40 views

How to write Apex test for record creation? [duplicate]

I'm having a hard time writing up a test class for the following Apex class: public class logger { @AuraEnabled public static void insertLog(string name, string id, string location, string ...
0
votes
2answers
28 views

Testing a trigger that is suppose to cover an failed check

I have a trigger on a custom Student object that is suppose to assign the lookup field Advisor based off of another look up field Gender. Basically my trigger goes: ... if (newStudent.Gender__c == ...
0
votes
1answer
21 views

Assign a record as a look up object before insertion

I am attempting to write an api endpoint meant to upload many objects of one type. This object, MyObject, contains a lookup field that looks up another MyObject record for translation reasons. ...
0
votes
1answer
53 views

Link files lead to new custom object

On Lead conversion I also create a new object to which I map several fields of the lead trough processbuilder. I also want to pass the files from the lead to the new custom object. I am trying to do a ...
0
votes
1answer
93 views

Is there a way to insert data with specific IDs?

I'm not sure if I'm explaining this correctly but I'll give it a shot. I'm trying to use Data Loader to insert CSVs of data into a Partial Pro sandbox, but I want these inserted records to use the ...
1
vote
1answer
206 views

Error: Too many DML rows: 10001

I have a question here, every time I run my code I first delete everything that is in the object, and then inserted a new list, when I try to do this simultaneously with the error ERROR System....
3
votes
4answers
643 views

|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object on my Apex Trigger

I'm kind of new in Apex development and I'm writing a before insert, before update trigger to a custom object that is going to be upserted through an API integration. Is very basic code but I don't ...
-2
votes
2answers
138 views

How to insert Lookup field value in a Trigger?

I am trying to build a after insert trigger on Contract object. Whenever user will create a Contract record trigger will generate/insert record of other object called Dim2. Dim2 have a lookup with ...
0
votes
1answer
191 views

Get record ID in Trigger.isBefore && Trigger.isInsert

I want to get the ID of the record in Trigger.isBefore && Trigger.isInsert. I need to start a batch process based on this ID. It works for Trigger.isUpdate but does not work for Trigger....
0
votes
3answers
454 views

How to find required fields for an sObject?

I know the question has already been posted, and answers where given ; I read this topic ; Of course I can try to insert the sObject and get the error listing the missing fields, But isn't it a '...
0
votes
3answers
250 views

Insert 2 objects (parent and child) at a time (over 200 records)

I have over 200 records, and I need to insert 2 lists. Work's records are created too fast and can't take a customField from still not inserted Case. If insert 1 per time - Error: Too many DML ...
1
vote
2answers
102 views

Why is my flag not working on maximum trigger depth exceeded

I have written a trigger for purchases if the purchase contains several of the same purchase detail items they should be summed up and merged as 1 purchase detail. When I use a before insert I get in ...
1
vote
1answer
166 views

DUPLICATE_VALUE Error Upon FieldPermissions Insert

We created a tool that scans Permission Sets of a installed managed package, "clones" these Permission Sets and removes any Permissions defined as too powerful. However upon FieldPermissions Insert i ...
1
vote
1answer
315 views

Unable to insert records using Iterable Batch class

I'm trying to create an Iterable Batch class for inserting records. I'm able to insert my records in my normal class. I have created the Batch class and am trying to call it my current class in the ...
2
votes
0answers
462 views

How to insert records in Big Object through developer console?

I am creating Big Object through workbench like Survey__b. I inserting record through developer console, in this time showing error: Variable does not exist. But i have all variables in the big ...
0
votes
1answer
105 views

Create one grandchild record per child record

I need to create automation that creates one grandchild record per child record, when criteria are met on the parent record. The initial criteria are straightforward: two field values on the parent ...
-2
votes
1answer
140 views

after insert,after update trigger doesn't work

Below is my trigger to create a new record(with next quarter) when Hold and freeze are set to true. But this works for new but not update. below is my trigger and . trigger AddingNewQuarter on ...
1
vote
1answer
46 views

Create Child record when Parent's Parent Updates

I have to be able to create a child record called "seats" when the parent of the parent object of "Seats" changes. Teams -->Tables---> Seats So when Team changes, I need to be able to create Seats ...
0
votes
1answer
73 views

Create Users Records with SFDX, Bad Timezone

I'm Trying to create one user record with by creating them with SFDX and the minimum required data about the user, into a scratch org (later trying it in an actual sandbox or production), but I have ...
0
votes
1answer
289 views

Create Child Record if a lookup on a Parent Object Changes

I'm pretty close to being maxed out on workflows for my custom objects. So I decided to see if apex classes could help, I'm still currently trying to learn how to write triggers and classes so Im ...
1
vote
1answer
732 views

Inserting Child Records with Master-Detail Relationships

I'm allowing a user to upload multiple files for accounts, contacts, and trades. Contact looks up to Accounts via a lookup field while trades look up to accounts via a master-detail relationship. I'...
-1
votes
1answer
160 views

Trigger:Too many soql query error

when I create or update record, am getting too many soql query error. following are my code: trigger UpdateAssetImageurl on SymphonyIPM__Patent__c (after insert,after update) { List<...
0
votes
0answers
55 views

Inserting Accounts and Contacts (that look up to the Account) in the same class

I'm trying to insert Accounts and Contacts in the same class. I'm inserting the account first, then inserting contacts, based on the account name. The account field in contacts is not getting ...
0
votes
1answer
215 views

Cannot Reference Contact fields in Validation Rule Formula

I'm trying to create a validation rule that disallows a User from creating a record if their contact has a certain checkbox checked. Unfortunately, when I reference the $User object, there is no ">" ...
1
vote
1answer
2k views

System.assertEquals for records in a list? Test class

I have a batch class that inserts Journal records after updating Account records... I am new to apex and cannot think how to test the inserted records in the test class. I have a list to get the ...
6
votes
0answers
142 views

Why inserting a user object and making callout in a test throws CalloutException in Production?

I stumbled upon strange behavior when executing tests on deployment to production organization. In the test, I first insert a User object, some other objects and then as the last one, a CampaignMember ...
0
votes
2answers
428 views

Trigger to update fields on record create or edit

I have a trigger on the OpportunityLineItem object that we use to update 4 revenue fields with specific calculations when the record is either created or updated. For some reason it seems the trigger ...
0
votes
1answer
802 views

Pass value from one method to another

How do I pass a value from one method to another. I am using a public list with a {get; set;} but this seems not to be working. What I want to achieve is to loop trough the insert from the first ...
3
votes
0answers
67 views

First event/event relation insert taking a while

I have an application that inserts events and event relations in an org's database and has a loading icon to prevent the user from doing anything until the event and relations are properly created and ...
0
votes
1answer
406 views

System.ListException: Before Insert or Upsert list must not have two identically equal elements for my DML operation [duplicate]

I have below code where I try to insert an SObject and getting an error as mentioned in subject. I have tried to fetch newly inserted records of say Object1, and putting them in Object2 lookup field ...
2
votes
2answers
560 views

Lead before update runs on insert

I have a fresh dev org, with nothing at all in it other than this one trigger that is below. When I create a new lead, this trigger is ran. (ie, I put the new leads name as John Smith and Company as ...
-4
votes
1answer
1k views

Method does not exist or incorrect signature: void isEmpty()

I Get te following error on my testclass: Method does not exist or incorrect signature: void isEmpty(). There are several answers to this but I still dont understand what is wrong with my testclass. ...
1
vote
2answers
504 views

How to Get Newly Created Id After Insert Called from an Event

I can't seem to get the Id of my newly created Contact record. When clicking the "Save Contact" button, the contact is saved, but I can't figure out how to reference the new Id. I would like to use it ...
0
votes
1answer
47 views

Error catching when inserting multiple object types

We have a page inserting three different object types. Historically, it has attempted to insert one and, assuming no errors (try and catch), moved to the next. Until all objects were inserted. If ...
0
votes
1answer
40 views

Trigger not assigning lookup id when inserting multiple records

I have a trigger which seems to be working when I insert transactions one at a time but when trying to insert multiple records I recieve the error: FATAL_ERROR System.DmlException: Insert failed. ...
0
votes
2answers
547 views

Cloning Opportunity with Synced Quote and its Quote Line Items

I'm trying to clone an Opportunity and its Synced Quote along with the Quote Line Items associated with that Synced Quote, but I can't seem to insert the cloned Quote Line Items. It doesn't throw any ...
0
votes
2answers
52 views

Getting 66% code coverage for trigger in sandbox; 0% in production

I have created a trigger on campaign member. Trigger gets 66% code coverage in sandbox and 0% in production. I know there's a million threads on this but none have solved my dilemma. Here is my ...