Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Is there a work around for Creating multiple Parent and Child Records in a Single Statement Using Foreign Keys for the same SObject?

Im working on inserting multiple campaign records with a self-relationship. I was hoping to do this with one DML statement using the method described here: Link I know in the first paragraph it says ...
JEbert's user avatar
  • 1
-1 votes
0 answers
35 views

Salesforce flow clone record with only one field changed

I am trying to clone a record but one field has different value then the original record. I watched videos but all of them are copying all fields one by one into a record variable adding it to the ...
Hasan Zubairi's user avatar
0 votes
2 answers
35 views

Create a new account from the old one

Morning all: I have a client who has changed some data in his business. I need to create a new account with this new data (name, TAX id...) but keep all the data (contracts, files...) from the old ...
Peppo's user avatar
  • 101
0 votes
1 answer
32 views

Using Clone() and setting external Id

I'm trying to clone a Case and modify a lookup using an external ID before inserting. The problem is that I have this error: System.DmlException: Insert failed. First exception on row 0; first error: ...
Julien Souchi's user avatar
-3 votes
1 answer
56 views

What do the SObject.clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber) method parameters do?

At Apex code while cloning the record: clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber) Need to know the each parameter how does it work. Contact obj = new Contact(Id ='...
Chetan Awate's user avatar
0 votes
0 answers
34 views

Weird Behavior on cloning object in visualforce

I'm having some weird issue where I'm trying to make a deep copy of an object on a button click, but when I do it rotates between a successful clone, and a copy of the object without any of the nested ...
Kevin Yao's user avatar
  • 103
0 votes
0 answers
35 views

Salesforce System Amin cloned profile

I cloned the System admin profile and realized it does not have the login as user option right beside a user's name. I created a delegated admin group and added the profile with the enable login ...
Tomi's user avatar
  • 1
0 votes
1 answer
132 views

Clone Created Date of Email Message with Apex

I'm trying to clone a row of an EmailMessage object to store the Created Date field with its original value. I am using the clone() Apex method https://developer.salesforce.com/docs/atlas.en-us....
Jota's user avatar
  • 25
0 votes
1 answer
68 views

Trigger to update parentId from cloned account

I am building my first account trigger which will clone the triggering record. On the cloned account I will update a field on it called 'Master Record' and set it to true. I also need to set the ...
cjohn's user avatar
  • 1
0 votes
3 answers
943 views

Cloning a record using Clone() method in apex not working

I am trying to clone a record using below code in apex. A new record is getting created but all the fields are empty. How to clone a record with all the fields values populated from the source record ...
Sfdc_Spider's user avatar
0 votes
1 answer
105 views

clone case custom button broken by "

"For example I have a case named "Test123, 321test" when I clone the case "321test" is considered a new field and breaks the formula. Here is the formula: {!URLFOR('/lightning/...
Dobrescu Andrei's user avatar
1 vote
0 answers
156 views

Show Dynamic Field Section only on Clone

When you enable Dynamic Forms, the 'New Record' form is determined by the Field Sections on your Record Page, instead of using the traditional Page Layout. I like to design custom forms when a user ...
Jerry Woods's user avatar
0 votes
1 answer
158 views

While cloning an Active Contract Record, ActivatedDate and ActivatedBy is not stamping correctly

For my requirement, I am able to clone an Active Contract but while cloning, The System Fields like Contract Activated Date and Contract Activated by is simply taking my user id values and not of the ...
Abhishek Verma's user avatar
-1 votes
1 answer
448 views

How Apex Clone Works

I tried cloning a PendingServiceRouting object within the apex class. But few attributes are missing in the cloned object(Id, CreatedDate). Can someone explain what is happening here? How can we copy ...
xyzabc's user avatar
  • 101
1 vote
1 answer
180 views

Apex Class: Bulk Clone Records and Increment Field

I am working on an Invocable Apex Class to Clone Records based on a selected Objects. The base code I got from here is working well. Now I am trying to add logic to increment a field after the record ...
Jeff Callahan's user avatar
0 votes
1 answer
150 views

Error While Cloning Products with Opportunity through Apex

I'm getting following error: List has more than 1 row for assignment to SObject Please find the code: //Clone Products Related With Opportunity OpportunityLineItem oppLineItemCloneRecord =...
Rose 's user avatar
  • 101
0 votes
1 answer
137 views

Trigger: Delete Child Cloned Opportunities If Parent Opportunity is deleted

I have to implement a functionality to delete all child cloned opportunity if parent opportunity is deleted. Details: There is a self lookup on Opportunity. Cloned opportunity is clone of opportunity ...
Rose 's user avatar
  • 101
0 votes
0 answers
53 views

Clone value using lightning dual Listbox

I need some help please . What I want from this code is that once the button is clicked Clone, we clone the name of the template, and generate Template Name Id which is concatination between the name ...
Salesforce Junior Dev's user avatar
0 votes
1 answer
3k views

Clone Record with lightning web component

I want to clone the template, and I want its name to be a concatination between the name of the template that I cloned with the id of the sales that I selected, as a result I want to have a template ...
Salesforce Junior Dev's user avatar
0 votes
2 answers
353 views

Lightning URL Hacking unable to copy custom lookup field value

I'm using lightning URL hacking to clone an opportunity where it is unable to fetch the custom lookup field value from Opportunity to the new cloned record while it is able to copy the AccountId(...
SMorse's user avatar
  • 47
0 votes
2 answers
201 views

How to Clone FeedComment Along with FeedItem using .clone function?

I am trying to Clone the feedItem along with FeedComment. I was successfully able to clone feedItem but unable to clone the FeedComments. Below is the snippet for (FeedItem feedRecord : feedItemList) {...
sfdcLearner's user avatar
0 votes
1 answer
409 views

Unable to Clone a record that has a Unique field

I have a scenario where I am trying to clone a custom object record which has a unique custom field. the unique field is : Tech_Unique__c. It is a Text field. When I am trying to clone I am getting ...
sfdcLearner's user avatar
0 votes
0 answers
486 views

Custom Clone button to allow record type selection before redirecting to cloned record edit page

I have a custom clone button on opportunity which clones an opportunity record along with its record type which is good. However, as part of this clone process we want to facilitate the user with the ...
SMorse's user avatar
  • 47
0 votes
1 answer
1k views

Can I deep clone a record but set the ID?

I have two account records. I want to move all of the data from account #1 into account #2. Is it possible to do a deep clone and set the ID? Or would I have to loop through account #1 and pull the ...
Olivia's user avatar
  • 3,391
0 votes
1 answer
834 views

SalesForce Action Button Not Passing Variables?

I've created a flow to clone Quote and related Quote Line Items (using this as a loose guide). I'm working in a sandbox environment. When I run 'Debug' in the Flow builder, the flow executes as ...
Alexis Frisch's user avatar
2 votes
1 answer
226 views

How to force calculation of Roll-Up Summary on "clone with Related"/"deepClone" action

We have a Roll-Up Summary field. It's a SUM aggregation of a field on custom childs of Opportunity. The field is set to "Automatic calculation (Recommended)". It usually works fine. For ...
Schnaps's user avatar
  • 319
0 votes
1 answer
1k views

is cloning quotes possible?

Is it possible to clone quotes? From my research, the information online seems to be conflicting: It appears that this is not natively available with Salesforce, as this functionality has been ...
h3110's user avatar
  • 57
0 votes
0 answers
283 views

Trying to create child Account record whenever a new Account is created

Instead of someone clicking on "Clone" button on an Account , we are trying to automate this process whenever a new Account is created. We need child account picklist field value filled in ...
Priya's user avatar
  • 1
0 votes
1 answer
31 views

Update(reassociate) lookups on newly created object from an old object

What is a better way of writing the below code so I can avoid repeating similar lines of code for every lookup object that I try to re associate Here Speaker & Session are Lookups on Event Object, ...
Sfdcnewuser's user avatar
0 votes
0 answers
19 views

Help with sobject clone() method [duplicate]

I am trying to implement the sboject clone() method in my test code and cannot get it to work properly. The code test if a service class performs as expected (record can not be edited if status is == '...
Sam's user avatar
  • 1
0 votes
1 answer
641 views

Issue with attachment in EmailMessage created via Apex trigger

I have a logic in EmailMessage trigger to create a new case when customer replies to a closed case. If the case is closed, I am cloning the case record to create new case. Since we cannot reparent ...
sf dev's user avatar
  • 98
0 votes
1 answer
743 views

Clone Opportunity using Quick Action

I'm trying to create a quick action button to allow reps to clone an opportunity. I noticed when I try to create this I can't select opportunity as the target object. Is this possible without code?
John's user avatar
  • 1
0 votes
1 answer
57 views

Copy Salesforce standard auto increment field to custom field [closed]

I'm trying to copy the 'Lead ID' field that's auto generated by Salesforce into a custom field. I'm unable to view this particular field under Leads but its coming up in reports. Is there a way to ...
sneha's user avatar
  • 1
1 vote
1 answer
219 views

Deep clone method for Primitive Data Types in Apex

How to deep clone the integer object or any other primitive data class object? What is a similar method to clone() in SObject for Integer? Integer a = 1232; // ... Integer b = a.clone(); // does not ...
Rahul Gawale's user avatar
  • 11.8k
0 votes
1 answer
175 views

Clone Opportunity. How make the difference between Clone and Cone with related in apex code?

I want to use Clone button in opportunity. There is also a Clone with related. I want to create a trigger in apex which can have different behaviour deending if user click on Clone or Clone with ...
Raph's user avatar
  • 1
0 votes
1 answer
942 views

How to Change some fields to default or make them null?

This is a pop-up when i try to clone a record. Whenever I clone, I want to change fields to their default value or make them null. Is there any way to do that using triggers/Other methods?
Rahul Allada's user avatar
0 votes
1 answer
2k views

How to get clone source Id for the records coming from database

Account acc0 = new account(name="acme"); Insert acc; Account acc1 = acc0.clone(); insert acc1; System.debug(acc1.getCloneSourceId()); //Producing expected result as the record(Acc1) is in ...
Rahul Allada's user avatar
1 vote
1 answer
1k views

isClone() not working as expected

Account acc = new account(name='Rahul'); insert acc; account acc1 = acc.clone(); insert acc1; Account accc = [select id from account where id =: acc1.id]; system.debug(accc.isClone());//Supposed to ...
Rahul Allada's user avatar
-1 votes
1 answer
1k views

How to clone indirectly related record using Apex trigger?

User case : Clone/copy records to new created record once it's lookup field is equal to another record's lookup field which have related records Trigger trigger TrigC on Test_C (after insert,after ...
Farkous's user avatar
  • 27
0 votes
1 answer
11k views

How to clone/copy records using apex? [closed]

Trigger trigger TRG_LinkCampaing on Test_Campaign__c (after insert,after update) { set<Id> ParID = new set<Id>(); for(Test_Campaign__c TestCamp : Trigger.new) { ...
user avatar
0 votes
1 answer
50 views

AuraEnabled Apex Class Returning Following Error: System.QueryException: List has no rows for assignment to SObject

In my following AuraEnabled class, I am trying to clone the current record displayed in my lightning component page. This lightning component implements force:hasRecordId and should insert it as new ...
Ertyq's user avatar
  • 321
0 votes
2 answers
109 views

List has no rows for assignment to SObject when cloning record

I an encountering the following error in my Auraenabled apex class: List has no rows for assignment to SObject I am aware that this occurs if the query doesn't return any rows, so I included a null ...
lol's user avatar
  • 93
0 votes
1 answer
386 views

Clone Opportunity through Salesforce REST API

I can see there was a standard functionality introduced by Salesforce to Clone and Clone with related for Opportunities, Therefore should be an endpoint available for this need, but I couldn't able to ...
Hariprasath's user avatar
0 votes
0 answers
580 views

Custom Clone Lightning Component Quick Action not working

I'm attempting to use this to create a clone of an Opp. It's set map over two fields. But I can't get it to work. It will only produce a blank square dialog box when the action is used. Here are the ...
Zoom_v's user avatar
  • 3,836
1 vote
1 answer
1k views

get the record from which a record is cloned

I want to get the details of the record from which I cloned. I tried using getCloneSourceId(), but it gives me the parent record data. I tried the following but didn't work for me. I cloned record B ...
Anurag's user avatar
  • 2,206
0 votes
1 answer
119 views

How to clone trigger.newmap when passing into a trigger hanlder [closed]

I was wondering how to clone trigger.newmap or how to still have access to the references associated to it when I want to pass this into a trigger handler.
Epsilon's user avatar
  • 11
0 votes
1 answer
482 views

The clone button wont clone opportunity with products in salesforce classic

Hi As per the below document from salesforce https://help.salesforce.com/articleView?id=000325215&type=1&mode=1 We have opportunity with products, when we try to clone the clone button did ...
Samuel Robert's user avatar
1 vote
1 answer
299 views

Error Message When Using Clone Method in External ID scenario

I'm currently wrapping my head around inserting both parent records and child records at the same time. The second requirement is that all fields must be cloned. Example: Clone an Account and all ...
Daniel's user avatar
  • 15
1 vote
1 answer
517 views

How to clone a Quote (CPQ) changing the Record type

I would like to change de record type when cloning the Quote, but it doesn't. What am I doing wrong? My code: From "Quote Custom Button or Link" Detail Page Button Behavior Display in existing ...
Pepe RUBIANES's user avatar
0 votes
1 answer
97 views

Before Insert or Upsert list must not have two identically equal elements even after instantiating within for loop

I have created this following class and test class below. My question is in my class in Line X(commented line X) if i use that instead of Line Y I am receiving the above mentioned error. I put the ...
codingislife's user avatar