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
197 views

Insert using Bulk API throws error MISSING_ARGUMENT:fiedXXX__c not specified:--

An external system is using bulk api to insert records in Salesforce. Salesforce throws an error saying - MISSING_ARGUMENT:fiedXXX__c not specified:-- where XXX is external Id of Parent of the ...
0
votes
1answer
332 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 ...
1
vote
2answers
97 views

Prevent insertion of records based on a condition

I have a zoo__c object. On Zoo__c , I have a field called firstName__c. I want to prevent insertion/updating of records if firstName__c has any of these characters at the end - "op" , "gp" , "kp". If ...
0
votes
1answer
46 views

Test class no inserting object

I have a test class that seems not to be inserting some setup objects I need for the test. My test class is as follows: @isTest(seealldata=false) private class Alertas_The_Influence_isTest{ public ...
0
votes
1answer
33 views

Trigger -Not throwing correct error message

I Am using this trigger to avoid duplicate records,whenever i run to test the trigger for inserting a record.It is correctly throwing error only for last two if condition.If i validate for first if ...
4
votes
1answer
7k views

Inserting Records using a lightning component

I am looking to make a lightning component to insert my Transaction__c object records against all relevant Contracts pulled back requiring action. As it stands I am returning all of relevant contracts/...
2
votes
1answer
1k views

REQUIRED_FIELD_MISSING & FIELD_INTEGRITY_EXCEPTION on PricebookEntry Insert

I want to use standard price for the Pricebook entry. PricebookEntry pbe = new PricebookEntry(Pricebook2Id='01sN00000002OTsIAM', IsActive=true, Product2Id='01tN0000004JGeuIAG', ...
1
vote
0answers
416 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
222 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 ...
2
votes
1answer
150 views

Uncommitted work in tests / Preparing for callouts

I have the following scenario in some unit tests: I need to create some data with inserts I need to invoke a method which performs a callout The test fails with the System.CalloutException: You have ...
0
votes
0answers
1k views

Salesforce Insert - Avoiding DUPLICATE_DEVELOPER_NAME errors

I am trying to insert Salesforce object records using APIs. Some objects throw errors with DUPLICATE_DEVELOPER_NAME errors. Some objects have Developer Name fields: 2017-05-01 16:33:35,379 ERROR - ...
0
votes
1answer
59 views

Master and child DML insert not working

I try to insert master and child simultaneously, however, it is not working: public PageReference Submit() { try { insert objectSelected; Id objectSelectedId = objectSelected....
0
votes
0answers
47 views

inserting a new object after updating an account

I am trying to insert a new custom object called Aid if 2 CheckBoxes in an account are checked. here is my trigger: trigger Aid on Account (before update) { for(Account acc: Trigger.new) { if(...
1
vote
2answers
1k views

update and insert not working

Upsert not working..update and insert not working..need help I have tried using the example given in salesforce visual force developer guide for upsert. It just inserts a new row. I tried in a ...
2
votes
0answers
502 views

Why doesn't Dataloader use specified 10k batch size when Bulk API is selected?

I have this sample CSV file containing 10,000 records (with 33 columns) I'd like to import it via Dataloader into Case object at my sandbox environment. I tried using these settings below with Bulk-...
0
votes
1answer
907 views

VF page for inserting and viewing object values

I need to make VF page for inserting new Contacts that shows pageBlockTable of all existing Contacts below. After i add recordSetVar="contacts" save button stops working. <apex:page ...
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
0answers
291 views

Error sending an email with function InsertDE (Ampscript)

This is my first contribution to this community. I'm having problems with sending an email when i'm using the function InsertDE whereas using other functions such as UpsertDE works fine, and the ...
5
votes
1answer
10k views

Inserting test record with record type

I'm trying to create a unit test where a I insert a record with a specific record type Student_Records__c endterm = new Student_Records__c(); endterm.School__c = schl.id; endterm....
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 ...
4
votes
1answer
3k views

INVALID_FIELD, Foreign key external ID not found - Inserting Related Records via External Id

I am trying to insert related records via an External Id. i am using an approach described here where we create an empty parent object with the same external Id like the "real" parent. It is a self-...
0
votes
1answer
305 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 ...
-1
votes
1answer
413 views

Button to create record based on current records data

I have a custom Invoice object on my organisation with multiple custom fields (prices, Due date, ...) and also a Credit Note checkbox to specify if it is a an invoice or a credit note. I would like a ...
1
vote
2answers
231 views

APEX fields on inserted sObject

I have custom fields on my Account object. Some of them have default value, let say "Days__c" as number with default value 0. When I insert the object like this: Account account = new Account(Name = ...
2
votes
1answer
46 views

Record won't insert - Apex Trigger

I have created an apex trigger so that it will create a record for everyday of an opportunities contract, I have run the code without the insert statement and my debug shows it works fine. What am I ...
0
votes
2answers
21 views

How to edit (and save) record after confirming that it has been inserted/upserted?

This NOT a trigger. This is a VF page controller. I think you should use try-catch blocks but I'm not sure whats the best practice for that. Should I put in all the code in the try block? Like this :...
7
votes
1answer
1k views

Inserting Accounts and Contacts Simultaneously

Trying to insert a new Account and it's Contact (maybe multiple Contacts?) at the same time. While researching this, I've come across various posts that are close to the solution, such as: ...
1
vote
1answer
151 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
1answer
243 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]; ...
0
votes
1answer
446 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(...
1
vote
0answers
164 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 ...
0
votes
0answers
397 views

After insert exception with Declarative Lookup Rollup Summaries Tool

I have a validation on account that throws an error if the below is true Locked__c = True && NOT(ISCHANGED( One_Time_Support_Counter__c )) && NOT(ISCHANGED( ...
0
votes
1answer
215 views

PopulateRelatedProductName2: execution of BeforeInsert caused by: System.StringException: Invalid id: ParentNameShouldBeHere: External entry point

I am trying to populate the Name field on a New Child Record, using the Parent Record Name. There will be a Record type that a user will choose from. The desired effect is that I want the Parent ...
0
votes
1answer
13 views

Is there a way of showing Salesforce a bunch of codes and it telling me how many exist already?

Basically I upload products into SF every week - we have had an issue with our product tool and basically may need to load in thousands that are missing. We identify every product with a 'module ...
0
votes
1answer
45 views

Trigger Calculation between two fields from different sObjects

I am new to apex. I have two objects blood_bank__c and patient__c. I want to change quantity of blood in blood bank after patient is given some blood. This trigger is not working, and its not allowing ...
1
vote
1answer
37 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 ...
0
votes
1answer
4k 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
2answers
602 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 ...
2
votes
3answers
382 views

Trying to get Code Coverage on my apex Class

I'm trying to get code coverage on my class to no avail. Any assistance would be greatly appreciated. I'm sure there is a better way to write my class but just trying to get the end user his request ...
0
votes
1answer
693 views

Confused about OrderProducts, OrderItems, and Products when making orders in test class

I'm making a test class that creates 5 orders and upon insert, I get the error that you need to add products to orders. I've got... List<Product2> clothProds = [SELECT Id FROM Product2 WHERE ...
0
votes
1answer
610 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); ...
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 ...
0
votes
1answer
229 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 ...
1
vote
2answers
908 views

How to get field values from VF page

I'm stuck with a really easy task. My VF page have StandardController and Extension. I'm using the standard fields for Task object : <apex:InputField value="{!Task.Client_Name__c}"/> So I ...
1
vote
1answer
666 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.
0
votes
1answer
655 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 ...
2
votes
2answers
698 views

Insert or update records dynamically through SOAP API's Partner jar

I am working on inserting CSV records to Salesforce. I usually do using Bulk API where the types are auto detected and mapped. However, I got into a scenario where I have to upload Documents or ...
2
votes
2answers
453 views

Error: Before Insert or Upsert list must not have two identically equal elements

Im getting above error when I try to add some custom records to a list and insert it later. Here's what Im doing. From the following code, I call a method from a different class (SetupBase) and add ...
1
vote
1answer
74 views

How does a trigger behave

Assume I have written a after insert trigger on an object A. I do some manipulation inside my trigger and at the end I create 3 to 4 new objects , that is a related list in Object A(Master-detail ...
0
votes
1answer
231 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 ...