Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
0
votes
1answer
31 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
38 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
29 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
65 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
42 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
65 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
259 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 ...
2
votes
2answers
134 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
106 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
127 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
115 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
42 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
1k 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
96 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
503 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
251 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
618 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
158 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
132 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
268 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
523 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
91 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
65 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
263 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
69 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
53 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
83 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
317 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
76 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
149 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
356 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
134 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
91 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
514 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
209 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
339 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
341 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
2k 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
534 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
399 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
980 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: ...
0
votes
2answers
277 views

Customizing Clone in Standard Page Layout

I'm in a need to create a custom button that will be placed on the standard page layout and that button will call to clone the record which the user is on and I could have used the standard clone ...
7
votes
2answers
956 views

Object clone does not work as expected

I have an object (not SObject!) with a member of type List, when I clone the object and add something to the list, the original record will also be modified: public class ThingToClone { public ...
1
vote
1answer
290 views

How Do I Clone An App

how do I clone an app so a few users can switch between apps using the Force.com app drop-down menu at the top-right corner. I want the same objects/functionality etc...for the cloned app. I have a ...
0
votes
4answers
2k views

Cloning a record and its children

EDITED to include apex Messages I have created a clone button on a Contact record which is designed to add another object (survey) and its child records (survey questions). My issue is that i cant ...
1
vote
1answer
189 views

How can I tell on the master record if it has been cloned

Is there a way to identify, with a checkbox for example, if a record has been cloned. I need to identify this on the master record, not on the record copy. I see there is the ISCLONE() but this ...
0
votes
1answer
2k views

Apex: Clone a record, then make the new record the Parent of the old cloned Record

Scenario: Our company needs to preserve old "Abandoned" cases (due to employee departure, etc) for tracking/metrics purposes, but also need to be able to "Transfer" the cases to a new employee. ...
1
vote
0answers
301 views

How to determine if record is being cloned when using lightning experience?

These methods are not working when using Lightning Experience getCloneSourceId() and isClone() so we like to know if there is a working to determine is a record is being cloned using Lightning.