Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
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 ...
0
votes
1answer
28 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
34 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){...
1
vote
1answer
269 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
1answer
36 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?...
5
votes
2answers
2k views

Opportunity standard Clone button. How to detect cloned record in an Apex trigger?

I have spent hours on it but haven't been able to figure out anything. The idea is simple: User clicks on standard Opportunity clone button. User selects either 'Clone without products' or 'Clone ...
0
votes
1answer
479 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 ...
2
votes
1answer
552 views

How to clone child records on any object with url content using standard clone button

i have tried to search a lot but not getting any solution for my problem. I would like to clone a parent object by clicking the standard clone button(Because all the fields are already prepopulated by ...
0
votes
1answer
518 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){ ...
0
votes
1answer
503 views

Custom button to Clone Opportunity is broken

I had a custom button which creates a clone opportunity with certain fields filled in which was working fine. I'm trying to make some tweaks to the button I must have inadvertently broken something ...
0
votes
1answer
394 views

How can i clone record use deepclone() method and update clone recorded id with its related list?

The problem arising clone recorded id does'not updated so and does'not appear related list and updated field so how should i do this? Apex class Public Class CloneVersionwithTextController{ Public ...
0
votes
1answer
499 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 ...
2
votes
2answers
476 views

Clone an email using the API: the email attribute _AdditionalEmailAttribute1 is not copied (SFMC)

We need your valuable help on SFMC. We have a HubExchange app and a large client (millions of users) is using it and having some serious issues. They have Web Analytics Connector enabled, which adds ...
0
votes
1answer
45 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
219 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 ...
1
vote
1answer
155 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 ...
2
votes
2answers
127 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
81 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
102 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 ...
2
votes
1answer
806 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 ...
0
votes
1answer
94 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
38 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?...
0
votes
0answers
87 views

Clone metadata using Tooling API

I am trying to clone Lightning Aura Bundle using Tooling API. First I executed the GET from REST Explorer using Workbench by passing the component Id. And then I used the Raw Response to hit the POST ...
0
votes
0answers
260 views

Clone Lightning Component Using Apex

I have used Metadata API to read and create Lightning Component, but I am able to clone only Lightning Component which is created by me. I am not able to clone all Lightning Component. Actually, I am ...
6
votes
6answers
2k views

Clone SObject Relationships

Is it possible to use a database query to get a set of related records and clone them into new related records. sObject[] sObjectsWithChildRelationships = [SELECT Id, (SELECT Id, myObject__c FROM ...
0
votes
4answers
1k 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
3answers
83 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
1answer
468 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 ...
-1
votes
2answers
776 views

How to clone a record in standard Opportunity object with its related list

I have created a apex class to clone a record with its related list. The record is cloned with related list but I am facing some issue. Those are: 1)after the click of clone button the record is ...
0
votes
1answer
229 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 ...
-2
votes
1answer
143 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
125 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
241 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
1
vote
1answer
76 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
226 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
67 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
51 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 ...
1
vote
3answers
1k views

While cloning the Opportunity, is it possible to copy only certain field values?

While cloning the Opportunity, is it possible to copy only certain field values. I want some fields to be empty whichmeans it should not contain the existing opportunity value. Thanks
4
votes
0answers
82 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
305 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
74 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
147 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
336 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
117 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
84 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 ...
5
votes
1answer
5k views

Clone list of SObject records using deepClone() to clone all the fields on records

I am trying to clone the records of a custom object. I know that I can use the deepClone() method of the List class to do this. List<MyCustomObject__c> originalList = [Select Id, Name, Age From ...
1
vote
0answers
998 views

Unable to cover Clone() method in test class

I'm having a simple code where I'm cloning an opportunity object with the necessary child elements. When I'm writing a test class for it, the clone method is not called and it is going into catch ...
3
votes
1answer
1k views

Clear the contents of a lookup field when cloning a record

An interesting question was asked about clearing the contents of a custom lookup field when URL hacking the clone button on an opportunity. The question was deleted by the asker, but the behavior is a ...
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 ...