Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
0
votes
0answers
43 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
38 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
26 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
12 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
39 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
28 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
0answers
16 views

isClone() returning false when first param of clone() is true

I have a custom button in UI which clones a record. In the constructor of a class, I clone the record as public ClassConstructor(SomeRecord record){ this.record = record.clone(true, true, true, true)...
0
votes
1answer
37 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
99 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
34 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
228 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
102 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
117 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
428 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
322 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
308 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
207 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
186 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
87 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
234 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 ...
3
votes
2answers
2k 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
620 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
348 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
915 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
261 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
184 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
325 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
624 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
142 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
90 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
534 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
81 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
64 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
86 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
367 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
191 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
489 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 ...
1
vote
0answers
220 views

Clone function on apex missing to copy fields [duplicate]

I've done a code to auto-renew contracts when they arrive to their renewal date. My idea is to create an exact clone of the old contract, change it's start date for the renewal date of the old ...
0
votes
2answers
114 views

how to modify LineItem fields when Clone Order With LineItems using URL hacking

I have a custom button on the order called Clone with Products. what it does: Clone the order Modify some order fields clone the LineItems Now I want to add a function to it so it will also modify ...
1
vote
1answer
2k views

Edit list of objects with a custom Lightning component?

I'm trying to figure out how to display a list of objects (and just a few certain fields) in a lightning component and expose those fields for editing. What my full app is supposed to do is clone a ...
0
votes
1answer
612 views

how to get selected opportunityLineitem by clicking on custom button in Opportunity detail

Is there any method to get selected record of opportunity line item byt clicking on custom button in opportuntiy detail page ? my requirement is : from the custom button on opportunity detail page ...
0
votes
1answer
249 views

DeepClone(false) missing documentation

I have class (v API 24) that clones a list of SObjects by calling deepClone(false) Can someone explain what the parameter means and how comes it is working if it doesn't appear on the list of ...
5
votes
1answer
405 views

How to deep clone Messaging.SingleEmailMessage?

Problem Statement I'm working on a fluent email builder, but I've hit a bit of a snag. Namely, there does not seem to be any simple way to completely clone a Messaging.SingleEmailMessage instance ...
0
votes
1answer
431 views

Query cloned records?

I have cloned some Opportunities now i want to Query Opportunities where IsClone == True. How can I achive this? List<opportunity> opportunities = [select id,Name,Contract_Start__c,...
2
votes
2answers
3k views

Copying ContentVersion Image File from one record to another with Apex

Is it possible to copy a ContentVersion image associated with one record so that the copy is associated with a different record? Code below gives me the following Execute Anonymous error.: Line: ...
0
votes
2answers
657 views

Clone User with Queues and PermissionSetAssignemnts?

I am trying to create a functionality to clone existing user, wherein i want to assign Public groups, queue and permission sets too. All the features along with profile and role id i would be ...
0
votes
1answer
448 views

Vague error message - duplicates value on record with id

It's vague error message and I have already spent several hours trying to find out what I'm doing but could not able to find the cause I'm trying to do SObject.clone and I'm not preserving the Id here ...
1
vote
1answer
1k views

Create Customize cloning , copying old to new record

UPDATE: AFter I have tried with the @Adrian approach I'm getting the following error now: |EXCEPTION_THROWN|[65]|System.DmlException: Insert failed. First exception on row 0; first error: ...