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
2answers
94 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. ...
3
votes
2answers
648 views

Remote Objects: Insert an array of objects

Is it possible to insert an array of objects using Remote Object Model? Here's my code: <apex:remoteObjects jsNamespace="romodel"> <apex:remoteObjectModel name="Stock__c" jsShorthand="...
1
vote
1answer
285 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 ...
0
votes
1answer
1k views

How do I pass values from a BEFORE trigger to an AFTER trigger to do an update to another object?

I have a BEFORE insert/update trigger on InvoiceLineItems which filters out certain line items that are not product lines (they are text narrative lines). This works nicely using the .addError option ...
0
votes
1answer
323 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 "...
10
votes
3answers
13k views

How to insert reports/dashboards inside a lightning component?

I'm facing issues in inserting reports inside the lightning component. As in VF pages we have analytics report tag or iframe..but in lightning i'm not able to find a solution. If any body has done it.....
0
votes
1answer
83 views

How to merge same account with multiple contact in apex class?

I am inserting Invoice based on my attendees object and inserting Invoice Line item based on that Invoice that is already created. so, My question is if the user will select multiple attendees, many ...
0
votes
1answer
56 views

Insert Contact then auto create an opportunity in NPSP

Good day everyone, My problem is something related on how NPSP works. Suppose I have 2 group of data, one is CONTACT and one is OPPORTUNITY. What I want to achieve is that I want to insert those 2 ...
2
votes
2answers
2k views

Insert data to custom object with relationship using external Id

Good day everyone, I have installed an npsp package and then I created a visual force that will save a new affiliation . I've tried to used an external Id to save the data. I've already tried saving ...
1
vote
1answer
128 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 ...
0
votes
1answer
33 views

Why is this insert statement causing an error?

Could anybody enlighten me as to why this piece of code is causing an error when I try to run it in Execute Anonymous? This is the code I am running from my test class: List<Case> newCases = ...
3
votes
2answers
3k views

Create static resource with apex code

Is there a way to create a StaticResource within a Apex code. this the code i am doing: StaticResource sr = new StaticResource(); sr.Body = file; sr.Name = 'testLicence'; ...
0
votes
0answers
268 views

Bypass Validation Rule because of After Insert Trigger

I have two objects A__C and B__c where B__C is the child of A__C. we have a before inert,before trigger on A__c and all after triggers on B__c. Basically the after trigger is used to calculate or roll ...
2
votes
2answers
1k views

How do I scalably run Apex after a small delay so that all related objects exist?

I'm trying to run Apex code that runs a little while after custom objects are created. The problem is that I have a few systems inserting and updating data when a customer places an order in an ...
2
votes
1answer
41 views

Problem with trigger execution on Opportunity batch insert

I've been dealing with this for a while now, and still haven't found a solution on the problem I am currently facing. So.. here is the situation. I have programmed a Trigger for the Opportunity ...
2
votes
2answers
361 views

Why is this Trigger not working

I've a question with this trigger. I checked the register and it launch the trigger but is not doing anything. It doesnt show me the debug messages, even the first one. The idea is that when we are ...
0
votes
1answer
247 views

Inserting Opportunities using dataloader

I am trying to insert opportunities using data loader. I have mapped all the fields correctly and all my accountid and ownerid are correct. Now when I am inserting, the job is failed and I am getting ...
1
vote
1answer
125 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 == '...
2
votes
2answers
360 views

Error when I try to clone an object

I'm trying to clone an object, here is the code: @RemoteAction global static void cloneRow(String idProj){ System.debug('@@ clone: '+idProj); ConfigeroPSA__Expense__c oldExp = [SELECT Id,Name,...
0
votes
0answers
20 views

How to upload a picture from android client to a custom object salesforce

I need to insert a picture taken by the phone camera, into a custom object in force.com. Does anyone know how to do it?
1
vote
2answers
2k views

Updating WhatId on Activity when Opportunity is Created

Here's something that I'm trying to do which I feel as though I've made it 75% of the way through. Right now let's assume I have the ability to generate an opportunity when a certain action is ...
2
votes
1answer
609 views

Trigger to insert new record not firing

I'm trying to create an Apex trigger that automatically creates a new record when some requirements are met. We have a custom object, Vendor Issues, which we would like to have new records created ...
0
votes
1answer
255 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 ...
3
votes
2answers
1k views

DML not allowed on User

I created some test users using the following apex code which worked perfectly fine: list<User> abc = new list<user>(); for(integer i=1; i<3;i++) { abc.add( new User( ...
0
votes
2answers
94 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 ...
2
votes
1answer
4k views

Apex Trigger giving “cannot specify Id in an insert call: [Id]” error

I'm pretty new to Apex and writing a simple trigger for when an account submits a form on our website (tracked on the formSubmit__c object) to create an Opportunity and am getting the following error ...
1
vote
0answers
588 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 ...
0
votes
1answer
303 views

Trying to insert records based on Opportunity Line Items

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
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
690 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 ...
2
votes
1answer
933 views

Storing json as a String field is giving wrong value

I have been developing an Apex Trigger where I build a json string from an incomming Event. What I do is serialize the event into the json at first, then deserialize it as a Map and add to it some ...
0
votes
1answer
468 views

Record Insert Delay - a Salesforce “queue” - avoiding Duplicate Leads/Contacts

I have been researching this, and am coming up with very little. I'm coming here before I attempt talking to Salesforce. General I've noticed in the past 2+ months that when inserting a new record, ...
0
votes
1answer
748 views

After Insert - Update Lookup on Custom object with other field

After performing a bulk upload, I need to update the Lookup on custom object. Matching field exists on the parent as external ID but that may add complexity. if field Custom.loc__c = DAV then update ...
0
votes
1answer
888 views

INVALID_FIELD_FOR_INSERT_UPDATE

I try to update an object from Tibco. While i try to do so I get the following error INVALID_FIELD_FOR_INSERT_UPDATE I have ensured that I am updating the field directly and not through any parent ...
3
votes
2answers
730 views

Adding new values to Custom Picklist (PHP Toolkit)

I'm using the PHP Toolkit for integrating a web application with my Salesforce account. I have this custom object: Individual__Choice__c that contains this custom Picklist: Primary_Option__c This ...
0
votes
1answer
108 views

How to insert records betweeen two orgs?

I want to do insert records between tow salesforce orgs using SOAP API . Can someone please guide me . For example i have student obj in Org A and also have student object in Org B . So when i insert ...
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. ...
2
votes
1answer
616 views

Upserting objects in Apex: can I assert which have been inserted / updated?

I'm upserting a list of custom objects in an Apex controller that are retrieved on demand from an external source. My object has an external identifier field used to help the database call determine ...