Questions tagged [clone]

copy details/field values from one object to another

Filter by
Sorted by
Tagged with
35
votes
7answers
26k views

Copying metadata and code from one Production org to another

How do I copy(for want of a better word) metadata (i.e. Objects, Workflows, Validation rule etc), and code (Apex, Visualforce, Triggers) from one Production org to another production org? Is this ...
19
votes
6answers
17k views

Deep Clone (Parent -> Child -> Grand Child)

I have a requirement to deep clone (Parent -> Child -> Grand Child) records by clicking a button at the Parent Level. I believe Salesforce supports only Clone at the Parent Level, it does not have ...
9
votes
2answers
5k views

Cloning a Wrapper Object in APEX

public class controllerName { public class WrapperClass { public CustomSObj__c custom {get; set;} public Boolean bool {get; set;} public WrapperClass(CustomSObjc__c custom) ...
8
votes
2answers
2k views

How to “deep clone including Attachments” without hitting the heap space governor limit?

I'm working on a "deep clone" Visualforce page where starting from an object, that object and its child objects and its grandparent objects and so on are cloned and that logic works fine. But any ...
8
votes
1answer
574 views

Does sObject IsClone() only works in Classic Aloha interface but not in Lightning Experience?

I've created an Apex trigger on CustomObject_A__c, it is working fine when I clone a record in Classic Aloha interface, but the trigger does not return True for isClone() sObject function call, when I ...
7
votes
2answers
914 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 ...
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 ...
5
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 ...
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 ...
5
votes
1answer
297 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 ...
5
votes
1answer
248 views

Apex Bug (?) Null Field Values of Cloned Instances Don't Persist?

I want to take the state of a source record, clone it, and apply the clone to a target record. But I'm encountering an issue in which a null field on the clone does not nullify the field on the target....
4
votes
0answers
81 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 ...
4
votes
2answers
698 views

Summer 14 and Price books [closed]

Since Summer 14 released this weekend every time I try and clone a product I get the below error message and I don’t understand what its saying? I think something changed with the price book in the ...
4
votes
3answers
1k views

Clone sObject field values from Wrapper class

I have created one wrapper class with sObject and index for sObject and im getting and setting list of wrapper to show on VF page. On VF page im showing some fields from that sObject and provided one ...
3
votes
1answer
418 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 ...
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 ...
3
votes
1answer
2k views

Create Custom Cloning Button - New Admin

I am relatively new to salesforce and administration. I am trying to create a custom cloning button that checks against the user profile name. I am using URL as content source. if({$Profile.Name}="...
3
votes
3answers
958 views

Clone Account without cloning opportunities

I am testing out cloning an account, but I would like the system to not clone some to the objects/fields. For example, I would like the clone button to clone the Address, phone and other info but not ...
3
votes
2answers
1k 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
0answers
63 views

Donations (NPSP) duplicating to cloned contact records

We are using the clone function to duplicate contacts. We noticed when we do this and then add a donation record to one of the contacts (the original contact we cloned from for example), the donation ...
2
votes
2answers
2k views

Database.query() default sort order

Does a Database.query() result maintain the order of the WHERE clause list I'm searching by? List<Id> myList = new List<Id>; myList.add('My Opportunity 1'); myList.add('My Opportunity 2');...
2
votes
2answers
121 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>(); ...
2
votes
2answers
483 views

Trigger for cloning isn't required for data loading

I have a 'Before Insert' trigger that was developed only because of the 'clone' functionality in SF. In our Managed Package if someone clones our custom object there are a number of fields that we ...
2
votes
3answers
307 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 ...
2
votes
2answers
955 views

Cloning opportunities - identifying which deals are “clones”

Suppose that at the end of each fiscal year, existing opportunities within Salesforce are "cloned." Over the course of the fiscal year, entirely new opportunities are created. So for a given fiscal ...
2
votes
1answer
178 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
1answer
868 views

Profile cloning and access settings on new profile

Is there any way to clone profile and allow that profile to have all field level access as previous(parent) profile? Scenario is, we haven't set some objects/fields as global on OWD, now when we ...
2
votes
1answer
470 views

Cloning records from 1 object to another object

I have 2 different objects objA and objB with same object model(all the fields api name and no of fields are same). Now when a change happens I want to clone the same records from objA to objB. It is ...
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: ...
2
votes
2answers
302 views

Salesforce cloning and integration

We have multiple salesforce orgs for multiple non profits. All of them need to have same functionality but different organization. Is there a way to clone all these organization? If I make changes, ...
2
votes
2answers
334 views

Error when I try to clone an object

I'm trying to clone an object, here is the code: @RemoteAction global static void cloneRow(String idProj){ System.debug('@@ clone: '+idProj); ConfigeroPSA__Expense__c oldExp = [SELECT Id,Name,...
2
votes
2answers
470 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 ...
2
votes
1answer
119 views

Cloning of lead records

Is there any way to find the parent of the cloned record? I have a lead record which should be cloned and i should be able to identify the lead record from the cloned new lead.
2
votes
2answers
706 views

Error inserting TaskRelation records

I have a client who wants the ability to clone a task that has multiple contacts. They would make slight changes to the cloned task (Assigned To, etc) but the multiple contacts would remain the same. ...
2
votes
2answers
1k views

Standard Clone Button - Setting Field Values - Custom Button Or Something Else?

Need: Ability to Clone records, and set a value into a field during the cloning. In my specific case, I want to populate either a Lookup field with the ID of the record cloned from (so passing ...
2
votes
1answer
286 views

How to Clone records on a pageBlockTable via Button

I'm very noob with apex and VF. My problem is: I've a pageBlockTable that shows a list of record from a Custom Object. Now I've a column of the table on which there's a button ("Clone") that should ...
2
votes
1answer
561 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 ...
2
votes
0answers
39 views

What are all the possible entry points for cloning a record?

In an org I have worked on, we needed to stop users from being able to clone a custom object record. (it just doesn't fit the business logic). To do this, I removed the "Clone" button from the page ...
2
votes
1answer
535 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 ...
2
votes
2answers
1k views

Deep clone parent and children without using Apex - possible?

I've seen some tools like Super Clone that can do deep clone (aka clone child records), but what I am looking for is a tool that clones record and then reparents the child records. I've seen there ...
2
votes
1answer
684 views

Copy picklist field when cloning an object

I'm using Apex to update the value of a field in an existing record for a particular object. I got it to work by changing the existing record and upsert it. The catch is I don't want to overwrite ...
1
vote
3answers
7k views

What is the quickest way to clone a custom object and make it a child\detail to another custom object?

I am trying to essentially re-create a custom object and then make the new copy a child to the original object. What is the quickest way to do this ? I have looked into it on App Exchange but it ...
1
vote
2answers
192 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
3answers
75 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 ...
1
vote
1answer
852 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: ...
1
vote
1answer
1k views

How to Clone/Copy Standard page for Accounts

I want to built certail function which seems not possible by creating custom fields in acounts....so wanted to know if it is possible copying or cloning the Acounts page so that i can build my custom ...
1
vote
3answers
2k views

Clone (Parent -> Child ) record with its related list using list button?

I have a requirement to clone (Parent -> Child ) records by clicking a button at the Parent Level with its realted list. I believe Salesforce supports Clone at the Parent Level, it does not have Clone ...
1
vote
1answer
143 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 ...
1
vote
1answer
241 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 ...
1
vote
1answer
811 views

clone two Maps with deepclone()

I have a Map with Date Like Key and all Event on that day as a List of values. Here the code I use to create the map: Map<Date,List<Event>> mappaeventidate= new Map<Date,List<Event&...