Questions tagged [insert]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
365 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 ...
1
vote
1answer
1k 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
vote
1answer
273 views

Apex method not creating record

My apex class is as follows: global class CreateDailyRSLI implements Schedulable{ List<Wildlife__c> LiveRhinosList = [SELECT id, Number_of_Sightings_Today__c FROM Wildlife__c]; ...
1
vote
1answer
46 views

Updating opportunity with APEX code

I want to add products to a specific opportunity via APEX code. Not sure how I would be able to do that. I know how to create an opportunity and insert it into the environment but wanted to make it ...
1
vote
1answer
159 views

Bulk Data Insertion that includes relationships

Good day everyone, I just want to ask your idea in regards with my problem. I am trying to read a data from csv and upload the data to salesforce. Below is an image of sample data in my csv. This is ...
1
vote
1answer
185 views

Trigger that inserts record from newly inserted record

I've Updated my code, and I'm still not getting the additional records inserted. My goal is; once an opportunity is closed a project is created. Once the project is created Credit Details (...
1
vote
1answer
791 views

How to upsert multiple records with Apex controller

This code is able to upsert a single record in salesforce. I want it to save multiple records by breaking the long string of dates contained in the datesFromCalendar. datesFromCalendar contains data ...
1
vote
1answer
36 views

At which level do duplicate rules work?

I'm trying to prevent the insertion of duplicate records from concurrent transactions. FOR UPDATE does not seem like a good candidate because the records are not updated, so there is nothing to lock. ...
1
vote
1answer
635 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
537 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
2answers
776 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 ...
1
vote
1answer
1k views

Stop Apex logic from running before update if it was already run before insert in the same transaction

Background: We have a custom object called Training History that stores customer training "minutes". Customers purchase minutes from us in blocks of 60, and we book Events for them in Salesforce for ...
1
vote
1answer
880 views

Prevent record from being inserted in before trigger without adding errors

Is it possible to prevent single record from being inserted in before trigger without addError()? I'd like to be able to insert just a subset of inserted records without throwing any errors.
1
vote
0answers
40 views

Insert Work Orders with randomized Latitude and Longitude Values for testing bulk scheduling in Field Service Lightning (FSL)

This code is supposed to insert 50 work orders with randomized geolocations. It's meant to create enough records of sample data to set the stage for demonstrating the power of bulk-scheduling/...
1
vote
1answer
280 views

FIELD_INTEGRITY_EXCEPTION, Every asset needs an account, a contact, or both and field comparison

I have been trying to insert new assets to the asset table and use the serial_number to check if the asset already exist before inserting it to avoid duplicates. I'm at the point where I am trying to ...
1
vote
1answer
760 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 ...
1
vote
0answers
577 views

Challenge when inserting records that has lookup field(that uses external Id of parent record)

In my scenario , I am loading records of object xyz__c in my system. This xyz__c has a lookup field that refers to abc__c object. I am loading records using an external system. It maps the fields on ...
1
vote
1answer
182 views

How can I insert a nested object graph using the Force.com .NET toolkit?

I am using the .NET toolkit to integrate a website I am developing into Salesforce. Primarily the client wants to push entire quotes into Salesforce with the website. At the moment I am creating the ...
1
vote
0answers
188 views

How to populate a SFMC/ExactTarget Data Extension from an external source like Hive/Cassandra/S3?

I am completely new to ExactTarget/SFMC, and am learning as I go along. There might be a use case where we aggregate events in Hive and store it in Hive tables or in Cassandra or in S3 buckets (we're ...
1
vote
0answers
90 views

Too many SOQL queries error on apex class

I have the class below getting data from a trigger (that seems to be working ok), the problem is, I am getting a "Too many SOQL queries" errors when it executes. If I comment out "insert ...
1
vote
1answer
334 views

Firing trigger on current record [closed]

I was just wondering if there is a way to fire an after insert and after update trigger on the page the user is viewing. The ApexPages.currentPage().getParameters().get('id') is not of much help I ...
1
vote
1answer
127 views

Trying to update a field after insert of new record

I am trying to set a boolean to true upon insert based on first this logic: if((pr.recordtypeid == '012g0000000D63fAAC' || pr.recordtypeid == '012g0000000D63iAAC' || pr.recordtypeid == '...
1
vote
0answers
592 views

Use of Maps for record inserts

I totally get and use Maps for updating records. No question. If I am getting duplicate entries in my List for inserts (obviously this is poor coding which can be avoided). Know that. Let's say I ...
1
vote
0answers
1k views

Insert Trigger not firing when creating record by REST API

I Have (after insert, after update) trigger on Account sObject. When I manually inserting or updating Account trigger fires, also when I updating existing Account via REST API request it fires too. ...
1
vote
1answer
391 views

Why is the Salesforce security scan saying I don't check isCreateable()?

I am baffled by the Salesforce automated security scan. I just ran it and it says: This query looks for sObject Create operations that are performed without checking for isCreatable(). This may be a ...
0
votes
4answers
1k 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
1answer
72 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
1answer
64 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
348 views

How to insert owner name in Account?

I have tried inserting a new record with ownerId and also with ownerName.But using "Ownername" shows the below error Account acc=new Account(Name='nEW',OwnerId='00528000001IpTb'); insert ...
0
votes
1answer
35 views

Trigger isUpdate being fired during insert

I have a trigger on an Account object that fires on update. In my unit test for the trigger, I create a test Account and insert it, which somehow causes the update trigger to fire. This causes an ...
0
votes
3answers
584 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 ...
0
votes
1answer
1k 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 ...
0
votes
1answer
1k views

Avoid Duplicate Id in a List

i have developed one visualforce page and it has multiple Group with Product and Bundle so, once user insert multiple Group with the Same product and same bundle then it's giving me an error as ...
0
votes
2answers
870 views

Invalid cross reference Error: Record Type ID: This ID Value Isn't Valid For The User:

While inserting data, though I do provide exact RecordTypeID by querying on workbench, I am unable to load only left with below error. Can someone please help? Record Type ID: This ID Value Isn't ...
0
votes
1answer
844 views

Checked required fields, still getting an error that a required field is missing on Insert

I have the following and get an error on the insert: Order o1 = new Order(Name ='anOrder', Account = test, Status = 'Activated', EffectiveDate = date.today(), Program__c = clothing.id); ...
0
votes
1answer
19 views

Ids and List<Account> after insert

In an Apex class method, I want to add several Accounts to a List. After a successful execution of the insert, can I access Ids? Example: List<Account> accounts = new List<Account>(); ...
0
votes
1answer
20 views

How to add value to a Picklist field in a custom object?

I want to insert a custom object and one of the field in the custom object is a Picklist (Multi-Select). I used the following code: PResources__c pResource = new PResources__c(); pResource.Name = ...
0
votes
1answer
386 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
1answer
494 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
2answers
54 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 ...
0
votes
1answer
456 views

isAfter is not working properly in apex trigger

I have built following apex trigger code and isAfter code is not executing because I have used recursive method in this trigger. Is it possible to run isAfter while trigger call first time ? Please ...
0
votes
1answer
400 views

Visualforce display Inserted record name

I have a visualforce page and controller that allows a user to make a clone of a record and all of its related records and associate a new contact (ie. copy a record for a new contact) Everything is ...
0
votes
1answer
455 views

Exception on insert

I have this class: @isTest private class DailyLeadProcessorTest { @testSetup public static void setupMethod(){ List&lt;Lead&gt; l = new List&lt;Lead&gt;(); for(...
0
votes
1answer
5k views

Challenging scenario while implementing a trigger

I have a specific scenario which I feel is a bit challenging and I would like to ask people's views in this forum on what they think could be a solution I have an custom object (employees__c) which ...
0
votes
1answer
267 views

Task trigger creating multiple records

I'm trying to override the standard log a call functionality but with some changes. When creating a log a call record it will be possible to select multiple users and multiple contacts. I've created ...
0
votes
1answer
745 views

Insert Attachment Saving 5 files in Notes and Attachment

I got into a problem when I save the pdf to lead attachment. Here is the scenario I have a Button on detail page of a Custom Object which is Child of Lead. This button opens a VF page and renders as ...
0
votes
2answers
98 views

Apex Class invoked by Trigger works fine for After Update, but not for After Insert

After many hours (possibly days!) I'm struggling to understand where the issue is with my code and your help would be much appreciated. I have a Trigger on the Quote Object, which calls a Apex Class. ...
0
votes
1answer
351 views

Cannot create new Product with custom visualforce page

I have a custom visualforce page that has the Product2 standard controller and a class as extension. The objective here is to make it possible to enter the product information, and the user can click "...
0
votes
1answer
261 views

Apex Data Loader problem

I am trying to insert data into a custom object. My MD field with Contacts is Email__c. I want to use the email to identify the contact as is the unique identifier for my custom object. ( like when ...
0
votes
2answers
96 views

Updating two object in a page, one trigger doesn't fire up

I have a custom page where I update and insert two objects. The main object is the account, after inserting the record in the account. I get the account Id to reference to its associated object. When ...