Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
0 votes
2 answers
22 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(...
user avatar
  • 25
0 votes
2 answers
29 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) {...
user avatar
0 votes
1 answer
44 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 ...
user avatar
0 votes
0 answers
34 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 ...
user avatar
  • 25
0 votes
1 answer
74 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 ...
user avatar
  • 3,167
0 votes
1 answer
83 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 ...
user avatar
2 votes
1 answer
37 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 ...
user avatar
  • 321
0 votes
0 answers
74 views

Salesforce CPQ Clone with Related not syncing Products

I have been stuck on this for a while. In my salesforce cpq, I can perfectly clone a quote using "clone with related" and sync it to a newly created opportunity and the quote comes over ...
user avatar
0 votes
1 answer
98 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 ...
user avatar
  • 79
0 votes
0 answers
73 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 ...
user avatar
  • 1
0 votes
1 answer
29 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, ...
user avatar
0 votes
0 answers
17 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 == '...
user avatar
  • 1
0 votes
1 answer
291 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 ...
user avatar
  • 81
0 votes
1 answer
320 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?
user avatar
  • 1
0 votes
1 answer
41 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 ...
user avatar
  • 1
1 vote
1 answer
99 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 ...
user avatar
  • 10.4k
0 votes
1 answer
106 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 ...
user avatar
  • 1
0 votes
1 answer
461 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?
user avatar
0 votes
1 answer
898 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 ...
user avatar
1 vote
1 answer
513 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 ...
user avatar
-1 votes
1 answer
573 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 ...
user avatar
  • 31
0 votes
1 answer
4k 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
41 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 ...
user avatar
  • 321
0 votes
2 answers
65 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 ...
user avatar
  • 93
0 votes
1 answer
155 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 ...
user avatar
0 votes
0 answers
368 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 ...
user avatar
  • 3,720
1 vote
1 answer
554 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 ...
user avatar
  • 2,136
0 votes
1 answer
76 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.
user avatar
  • 11
0 votes
1 answer
209 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 ...
user avatar
0 votes
1 answer
107 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 ...
user avatar
  • 5
1 vote
1 answer
341 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 ...
user avatar
0 votes
1 answer
52 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 ...
user avatar
0 votes
1 answer
819 views

SyncedQuote field is read only within a trigger

I'm trying to clone an Opportunity at before update event of Opportunity. But it throws me error, Opportunity SyncedQuote field is read only within a trigger for(Opportunity oppoFull :listOpp){...
user avatar
0 votes
1 answer
281 views

How to deep clone a batch class?

I have tried deep cloning on the opportunity object which has closed won stages it will also clone the Related Products I have tried cloning the opportunity and it works okay,how will i deep clone it?...
user avatar
0 votes
1 answer
283 views

Prevent cloning of Opportunities with products

Here it says In Lightning Experience, opportunities with products can’t be cloned. I tested this out and I was actually able to clone and Opportunity with products using the standard clone button ...
user avatar
2 votes
1 answer
757 views

How to clone custom child of CPQ Quote Line during Favorite usage

I have customized Salesforce CPQ in a way displayed in the ER diagram below. Everything is standard beside one custom child object of the SBQQ_QuoteLine__c called QuoteLineConfiguration__c . I need ...
user avatar
3 votes
2 answers
2k views

Benefits of using sObject.clone versus creating a new record

Hello I am curious whats the use case of the clone method. Also when its beneficial. Example here I create a lead once then clone it 200 times. list<lead> leadlist = new list<lead>(); ...
user avatar
0 votes
1 answer
992 views

How do you write a test for a class that clones? [duplicate]

I have the following code that clones an asset and its' children... public class Cloner { public Asset root_asset { get; set; } public Asset cloned_root_asset {get; set; } public ...
user avatar
  • 15
0 votes
2 answers
347 views

Salesforce Lightning: Custom clone case with a link to attachement

I just created a lightning component + quick action to clone a case (It's working). But i want to link the attachement of the old case to the new one (I don't want to clone it). i tried with ...
user avatar
0 votes
1 answer
344 views

Cloning Parent -> Child -> Grand Child

I have one similar problem asked here. But My Objects are Project(Parent) -- > Milestone(Child) --> Action(GrandChild).. Deep Clone (Parent -> Child -> Grand Child) I have tried using the ...
user avatar
  • 41
0 votes
1 answer
228 views

Cloning and manipulating my cloned record in apex is also affecting the original record

I am creating a clone opportunity line item in apex. However when I manipulte the fields of this clone, the original record is also being manipulated. Does anyone have any idea why this is happenning?...
user avatar
2 votes
1 answer
3k views

Standard Actions and Custom clone button

I need to override the clone functionality to pre-populate certain fields on custom object that is being cloned. So I have this URL button and passed in the record being cloned as an id in the url of ...
user avatar
1 vote
3 answers
809 views

How do I stop this trigger from running more than once?

I'm still fairly new to Apex. Currently in our org we have a class called CommitmentProcess and a trigger called CommitmentTrigger. We use this to clone Opportunities that are up for renewal. So for ...
user avatar
4 votes
2 answers
3k views

How to use force:recordData to clone a record?

I'm trying to clone an Opportunity record with certain values changed. Below is my code (component will be launched from Lightning component action). My Component Markup <aura:component ...
user avatar
3 votes
1 answer
874 views

Does standard clone button excludes fields not present on pagelayout

Does standard clone button clones fields present only on the page layout and not exactly a 'obj.clone() functionality? Note: I tried clone by removing a field from pagelayout and I donot see that ...
user avatar
0 votes
1 answer
533 views

Deep Cloning a Product - Clone Standard Price and Custom Prices

I have created a Record Detail button to clone a Product's detail, a related list called Bill of Materials, and both the Standard PB Entry, and any Custom PB Entries. If I remove the Custom PB Entry ...
user avatar
0 votes
1 answer
2k views

Apex Trigger for Cloned Record - Values changing before and after insert

I have the following trigger for changing values when a record is cloned: trigger oppAutomation on Opportunity (before insert) { if(trigger.isBefore){ if(trigger.isInsert){ ...
user avatar
-2 votes
1 answer
570 views

Custom Clone of specific fields only using the standard form in VF [closed]

Is there a way to clone specific fields and save only when the save button is click? Only five fields should be cloned, assign new value to one field and the rest of the fields are empty. below is ...
user avatar
  • 41
0 votes
0 answers
701 views

Clone button on Report not displaying

For some time now the clone button on the Report object has been missing in both lightning and classic. I'm trying to identify why and get it back up there since this button makes our lives so much ...
user avatar
1 vote
2 answers
520 views

How to mark a field as readonly when we clone a record?

I want to mark a single field as read only when I clone a record. I am not able to find which page layout is in action when we clone a record
user avatar