Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
0
votes
1answer
29 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 ...
0
votes
1answer
29 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 ...
0
votes
0answers
17 views

Cloning Opportunity Line Item does not add Product Schedule

I am trying to clone opportunity line items for an opportunity, and am able to clone successfully, get the price, quantity, pricebookentry, etc, but the Schedule does not transfer. Does anyone have ...
0
votes
1answer
43 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?
0
votes
1answer
50 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 ...
1
vote
1answer
45 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 ...
-1
votes
1answer
143 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 ...
0
votes
1answer
122 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) { ...
0
votes
1answer
31 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 ...
0
votes
2answers
41 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 ...
0
votes
1answer
36 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 ...
0
votes
0answers
117 views

Clone Case in Lightning

I am trying to use the Out Of Box Clone button in lightning and looks like it auto populates all the fields from the Parent Case to the newly created case but not the parent Case field. The Parent ...
0
votes
0answers
161 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 ...
1
vote
1answer
155 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 ...
0
votes
0answers
42 views

Is it possible to Clone previous row values to the next row? Dynamic add, delete row functionality

<lightning:recordEditForm aura:id="editFormAccount" objectApiName="Account"> <table class="slds-table slds-table_bordered slds-table_col-bordered" style="min-width: ...
0
votes
0answers
20 views

Mass Clone Records on a Schedule

I need to mass clone about 200 records 4x a year. Quick summary of the problem I'm trying to solve. I work for a used textbook company, each school term (quarterly), we go to our school customers and ...
0
votes
1answer
46 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.
0
votes
1answer
51 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 ...
0
votes
1answer
43 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 ...
1
vote
1answer
188 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 ...
0
votes
1answer
40 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 ...
0
votes
1answer
387 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){...
0
votes
1answer
170 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?...
0
votes
1answer
161 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 ...
2
votes
1answer
557 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 ...
3
votes
2answers
823 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>(); ...
0
votes
1answer
546 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 ...
0
votes
2answers
268 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 ...
0
votes
1answer
255 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 ...
0
votes
1answer
126 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?...
2
votes
1answer
2k 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 ...
1
vote
3answers
421 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 ...
4
votes
2answers
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 ...
3
votes
1answer
681 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 ...
0
votes
1answer
412 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 ...
0
votes
1answer
1k 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){ ...
-2
votes
1answer
360 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 ...
0
votes
0answers
225 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 ...
1
vote
2answers
381 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
0
votes
1answer
691 views

How to populate original opportunity create date on cloned opportunity

At the beginning of every year, we mass update any open opportunities that were created 2 years prior and prevent users from changing the sales stage back to an open stage. In the event that any of ...
1
vote
1answer
187 views

Cloning Opportunities Not Calculating Expected Revenue

I have an issue where upon cloning opportunities are not calculating expected revenue from original records on a sporadic basis. There seems to be little commonality in the errors outside of expected ...
1
vote
1answer
106 views

Marking the Old Version of a Record After Trigger

This is more of an implementation question than code review. I am currently using the 'clone' standard button that triggers changes on the new cloned record. However, I also have to mark the old ...
-3
votes
1answer
789 views

How to check if the logged in user has permission to view a data field in apex code?

I need to create a custom Clone button to clone only data fields in which the logged in user has view permission to (in the his assigned permission set). how do I do that using the Apex class? thanks!...
-1
votes
1answer
88 views

Why Doesn't the Clone Work on This Controller?

I'm trying to conditionally clone a record. I'm using a trigger with this, but I just get a saved record with the values my trigger passes in. I've tried putting the page reference action in the apex ...
0
votes
0answers
74 views

how to make sure the user knows and is ok with the value of 1 field during use of the (standard) clone button

Update: isClone() formula and apex method are not working for me (see comments in this post) I was thinking to use before Apex and a Validation Rule (below, not working). Would you solve this ...
4
votes
0answers
88 views

record.clone().clone() instead of .clone()?

We are using Andrew Fawcett's SObjectDataloader Library where I fixed a couple things and stumbled over odd behavior that I couldn't find valid explanation for. So in the Library, records are ...
0
votes
1answer
387 views

Clone Opportunity via Visualforce Page

Using this page I have the following apex on a visualforce page,that I want to run when a user saves the opportunity as 'won'. My questions are: 1. How do I add it as a popup when the user saves ...
0
votes
0answers
79 views

$Action.Clone not being saved

I'm using the $Action.clone as a simple command button on a VisualForce page. This works for my user account and profile as an admin. However other users can create the interim SObject but get the ...
1
vote
1answer
230 views

Trigger to prevent duplication of records not working on cloning record for the first time

One of my object is having Lookup Relationship with Account. I want a functionality where we can not allow to have 2 records with the same Name, same Related Account, and same Owner. I have tried 2 ...
2
votes
3answers
596 views

Checkbox field -

I created a custom checkbox in the opportunity box so that an email is sent out to the team whenever it is checked. Issue is that an email is sent out if someone clones that opportunity. Is there a ...