function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tamika King 5Tamika King 5 

I'm struggling with trying to clone multiple line items, I've created a custom clone list button but i'm not sure my code is correct:

/{!Plan__c.Name}/e?clone=1&retURL=%2F{!Plan__c.Name}&{!User.Id }&{!Plan__c.Donation_Year__c}&{!Plan__c.Facility__c}&{!Plan__c.Plan_Status__c}&{!Plan__c.Approved_Amount__c}&{!Plan__c.Proposed_amount__c}
 
I've even tried removing the field names and using there id instead but still no luck
 
/{00B46000002vEz2}/e?clone=1&retURL=/{00B46000002vEz2} &cloneli=1
&00N46000006jQ7w=
&00N46000006jPuW=
&00N46000006l5Or=
&00N4600000B6l9n=
&00N4600000B6l9d=
 
Please advise if you see anything wrong or if this is something that can be done in salesforce.
Best Answer chosen by Tamika King 5
RbnRbn
Hi Tamika,

The error is because you have not created the plancollection variable in the flow.

You have to create something like this below for both loop through & Loop Variable.

User-added image

All Answers

RbnRbn
Hi Tamika,

You can achieve this functionality by making use of Flow in Salesforce.

Below is a url which can help you in achieving your functionality of cloning multiple line items.

https://focusonforce.com/configuration/clone-of-opportunities-and-line-items-using-visual-workflow/

Let me know if you would require any further help on this.

Cheers,
Rabi
Tamika King 5Tamika King 5
Thanks Rabi, I'm following the steps but ran into this error:

Error: No variable named "PlanCollection" in flow.

This is my code:

<apex:page standardController="Plan__c" tabStyle="Plan__c" recordSetVar="CopyofPlans">
  <!-- Begin Default Content REMOVE THIS -->
  <flow:interview name="PlanClone"
        finishLocation="{!URLFOR($Action.Plan__c.Tab, $ObjectType.Plan__c)}">
        <apex:param name="PlanCollection" value="{!Selected}"/>
  </flow:interview>
  </apex:page>
 
 
I have PlanCollection listed as my variable in

User-added image
Any idea?

 
RbnRbn
Hi Tamika,

The error is because you have not created the plancollection variable in the flow.

You have to create something like this below for both loop through & Loop Variable.

User-added image
This was selected as the best answer
Tamika King 5Tamika King 5
Great Thanks!