Questions tagged [clone]
copy details/field values from one object to another
175
questions
0
votes
1
answer
23
views
How to clone a record along with its related list?
I need to clone all Account records along with their contact records. I'm using clone() method in Apex for this. Below is the code I have written:
List<Account> accListToClone = new List<...
0
votes
0
answers
40
views
Assigning Clone Button on Lightning Related List
The attached screenshot shows a Skills list that is related to Participants with a Lookup(Participants) relationship. Notice Dropdown next to each item in the list allows Edit or Delete. I would like ...
0
votes
1
answer
68
views
"Clone with related" button does not work on Product page
We are facing an issue when trying to clone a Product with ist related lists.
It is a CPQ button : (Button or Link URL /apex/SBQQ__CloneProductChildren?id={!Product2.Id})
It is strange because ...
0
votes
0
answers
42
views
Partial cloning
I'd like to write an Apex Class that partially clones Opportunities.
Partially means I want to clone my related custom products, but not my related tenders (we call it "RFQs").
If I got it ...
1
vote
0
answers
136
views
Update Approval Status field as null for new cloned quote
I created a flow that updates the Approval Status as blank and Status as 'Draft' for newly created Cloned Quotes. I put the starting condition of the flow as below :-
This seems to work fine for some ...
0
votes
0
answers
72
views
How to Turn Off Auto Populating fields on cloned contracts?
My Company uses "Clone" button a lot for Contracts when they are renewing the Contract. There are certain field values that need to be changed. Is there any way not to copy certain fields' ...
0
votes
0
answers
28
views
Is there a work around for Creating multiple Parent and Child Records in a Single Statement Using Foreign Keys for the same SObject?
Im working on inserting multiple campaign records with a self-relationship. I was hoping to do this with one DML statement using the method described here: Link
I know in the first paragraph it says ...
0
votes
2
answers
369
views
Create a new account from the old one
Morning all:
I have a client who has changed some data in his business. I need to create a new account with this new data (name, TAX id...) but keep all the data (contracts, files...) from the old ...
0
votes
1
answer
196
views
Using Clone() and setting external Id
I'm trying to clone a Case and modify a lookup using an external ID before inserting.
The problem is that I have this error:
System.DmlException: Insert failed. First exception on row 0; first error: ...
-3
votes
1
answer
442
views
What do the SObject.clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber) method parameters do?
At Apex code while cloning the record:
clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber)
Need to know the each parameter how does it work.
Contact obj = new Contact(Id ='...
0
votes
0
answers
35
views
Weird Behavior on cloning object in visualforce
I'm having some weird issue where I'm trying to make a deep copy of an object on a button click, but when I do it rotates between a successful clone, and a copy of the object without any of the nested ...
-1
votes
1
answer
133
views
Salesforce System Amin cloned profile
I cloned the System admin profile and realized it does not have the login as user option right beside a user's name. I created a delegated admin group and added the profile with the enable login ...
0
votes
1
answer
254
views
Clone Created Date of Email Message with Apex
I'm trying to clone a row of an EmailMessage object to store the Created Date field with its original value. I am using the clone() Apex method https://developer.salesforce.com/docs/atlas.en-us....
0
votes
1
answer
115
views
Trigger to update parentId from cloned account
I am building my first account trigger which will clone the triggering record. On the cloned account I will update a field on it called 'Master Record' and set it to true. I also need to set the ...
0
votes
3
answers
3k
views
Cloning a record using Clone() method in apex not working
I am trying to clone a record using below code in apex. A new record is getting created but all the fields are empty. How to clone a record with all the fields values populated from the source record ...
0
votes
1
answer
123
views
clone case custom button broken by "
"For example I have a case named "Test123, 321test" when I clone the case "321test" is considered a new field and breaks the formula.
Here is the formula:
{!URLFOR('/lightning/...
1
vote
1
answer
352
views
Show Dynamic Field Section only on Clone
When you enable Dynamic Forms, the 'New Record' form is determined by the Field Sections on your Record Page, instead of using the traditional Page Layout. I like to design custom forms when a user ...
0
votes
1
answer
290
views
While cloning an Active Contract Record, ActivatedDate and ActivatedBy is not stamping correctly
For my requirement, I am able to clone an Active Contract but while cloning, The System Fields like Contract Activated Date and Contract Activated by is simply taking my user id values and not of the ...
1
vote
1
answer
3k
views
How Apex Clone Works
I tried cloning a PendingServiceRouting object within the apex class. But few attributes are missing in the cloned object(Id, CreatedDate). Can someone explain what is happening here? How can we copy ...
1
vote
1
answer
294
views
Apex Class: Bulk Clone Records and Increment Field
I am working on an Invocable Apex Class to Clone Records based on a selected Objects. The base code I got from here is working well.
Now I am trying to add logic to increment a field after the record ...
0
votes
1
answer
192
views
Error While Cloning Products with Opportunity through Apex
I'm getting following error: List has more than 1 row for assignment to SObject
Please find the code:
//Clone Products Related With Opportunity
OpportunityLineItem oppLineItemCloneRecord =...
0
votes
1
answer
179
views
Trigger: Delete Child Cloned Opportunities If Parent Opportunity is deleted
I have to implement a functionality to delete all child cloned opportunity if parent opportunity is deleted.
Details:
There is a self lookup on Opportunity.
Cloned opportunity is clone of opportunity ...
0
votes
0
answers
72
views
Clone value using lightning dual Listbox
I need some help please .
What I want from this code is that once the button is clicked
Clone, we clone the name of the template, and generate Template Name Id which is concatination between the name ...
0
votes
1
answer
4k
views
Clone Record with lightning web component
I want to clone the template, and I want its name to be a concatination between the name of the template that I cloned with the id of the sales that I selected, as a result I want to have a template ...
0
votes
2
answers
610
views
Lightning URL Hacking unable to copy custom lookup field value
I'm using lightning URL hacking to clone an opportunity where it is unable to fetch the custom lookup field value from Opportunity to the new cloned record while it is able to copy the AccountId(...
0
votes
2
answers
360
views
How to Clone FeedComment Along with FeedItem using .clone function?
I am trying to Clone the feedItem along with FeedComment. I was successfully able to clone feedItem but unable to clone the FeedComments. Below is the snippet
for (FeedItem feedRecord : feedItemList) {...
0
votes
1
answer
550
views
Unable to Clone a record that has a Unique field
I have a scenario where I am trying to clone a custom object record which has a unique custom field. the unique field is : Tech_Unique__c. It is a Text field. When I am trying to clone I am getting ...
0
votes
0
answers
636
views
Custom Clone button to allow record type selection before redirecting to cloned record edit page
I have a custom clone button on opportunity which clones an opportunity record along with its record type which is good. However, as part of this clone process we want to facilitate the user with the ...
0
votes
1
answer
2k
views
Can I deep clone a record but set the ID?
I have two account records. I want to move all of the data from account #1 into account #2. Is it possible to do a deep clone and set the ID? Or would I have to loop through account #1 and pull the ...
0
votes
1
answer
1k
views
SalesForce Action Button Not Passing Variables?
I've created a flow to clone Quote and related Quote Line Items (using this as a loose guide).
I'm working in a sandbox environment. When I run 'Debug' in the Flow builder, the flow executes as ...
2
votes
1
answer
280
views
How to force calculation of Roll-Up Summary on "clone with Related"/"deepClone" action
We have a Roll-Up Summary field. It's a SUM aggregation of a field on custom childs of Opportunity. The field is set to "Automatic calculation (Recommended)". It usually works fine. For ...
0
votes
1
answer
2k
views
is cloning quotes possible?
Is it possible to clone quotes?
From my research, the information online seems to be conflicting:
It appears that this is not natively available with Salesforce, as this functionality has been ...
0
votes
0
answers
320
views
Trying to create child Account record whenever a new Account is created
Instead of someone clicking on "Clone" button on an Account , we are trying to automate this process whenever a new Account is created. We need child account picklist field value filled in ...
0
votes
1
answer
33
views
Update(reassociate) lookups on newly created object from an old object
What is a better way of writing the below code so I can avoid repeating similar lines of code for every lookup object that I try to re associate
Here Speaker & Session are Lookups on Event Object, ...
0
votes
0
answers
19
views
Help with sobject clone() method [duplicate]
I am trying to implement the sboject clone() method in my test code and cannot get it to work properly. The code test if a service class performs as expected (record can not be edited if status is == '...
0
votes
1
answer
913
views
Issue with attachment in EmailMessage created via Apex trigger
I have a logic in EmailMessage trigger to create a new case when customer replies to a closed case.
If the case is closed, I am cloning the case record to create new case. Since we cannot reparent ...
0
votes
1
answer
905
views
Clone Opportunity using Quick Action
I'm trying to create a quick action button to allow reps to clone an opportunity. I noticed when I try to create this I can't select opportunity as the target object. Is this possible without code?
0
votes
1
answer
77
views
Copy Salesforce standard auto increment field to custom field [closed]
I'm trying to copy the 'Lead ID' field that's auto generated by Salesforce into a custom field. I'm unable to view this particular field under Leads but its coming up in reports. Is there a way to ...
1
vote
1
answer
311
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
1
answer
209
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
1
answer
1k
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
1
answer
3k
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
1
answer
2k
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
1
answer
1k
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 ...
1
vote
1
answer
17k
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
1
answer
51
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
2
answers
123
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
1
answer
540
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
0
answers
649
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
1
answer
2k
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 ...