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
ywangywang 

How to copy a multi-select item?

Hi all!
 
I am working on developing a scon to copy an Account just like the copy button on Opportunity scene.
But a multi -select item was found not  be copied well
 
For Example, The original item has  multi-selected  a,b and c. the copied item will be shown as "a;b;c"  in one row.
 
 
The source code of the s-con is as following.
 
<body onLoad="document.myForm.submit()">
<form method="POST" action="/001/e" name="myForm">
<input type=hidden name="RecordType" id="RecordType" value="012100000008S5Z">
 
<input type=hidden name="00N10000000IlGg" id="00N10000000IlGg" value="{!Account_MHFGSections3}">

</body> 
 
Bye the way, I knew that the same problem could be done by using URL as following
But for this case I have over 50 choices, so the URL pattern will not work .
 
Could  anybody  give me a hint?
 
AnthonyAnthony

Ywang / Community,

I'm looking for the exactly the same type of solution.

Did you ever get a solution for this problem?  Anybody?

Thanks,

Anthony

AnthonyAnthony

Ywang,

Your code got me going in the right direction, I like the Form/Submit technique.  Below is a method that worked pretty well.  This S-Control runs in the same browser windows (not a popup).

The trick is to parse the semi-colon delimited value then write a form variable line for each value.

I am processing 4 different mult-select picklists in the code below.  I tested it with blank, 1 and multiple values.

Hope this helps!

Anthony

Code:

<html> 
<head> 
</head> 
<body onLoad="document.myForm.submit()"> 
<form method="POST" action="/a04/e" name="myForm"> 
<input type=hidden name="retURL" id="CF00N50000001U9bd_lkid" value="/{!Contact.Id}"> 
<input type=hidden name="CF00N50000001U9bd_lkid" id="CF00N50000001U9bd_lkid" value="{!Contact.Id}"> 

<input type=hidden name="CF00N50000001U9bd" id="CF00N50000001U9bd" value="{!Contact.Name}"> 
<input type=hidden name="CF00N50000001U9bc" id="CF00N50000001U9bc" value="{!Account.Name}"> 
<input type=hidden name="00N50000001U9ba" id="00N50000001U9ba" value="{!Contact.Start_Date__c}"> 
<input type=hidden name="00N50000001U9bb" id="00N50000001U9bb" value="{!Contact.Position_Description__c}"> 

<script type='text/javascript'> 
{ 
//These merge variables are filled in by the server prior to javascript//execution.
var myPosition = '{!Contact.Position__c}'; 
var myTerritory = '{!Contact.Territory__c}'; 
var myProducts = '{!Contact.Products__c}'; 
var myChannels = '{!Contact.Distribution_Channels__c}'; 

//alert("Remember to fill in the To Date!"); 

// Position 
var myString = myPosition; 
var mySplitResult = myString.split(";"); 
for(i = 0; i < mySplitResult.length; i++){ 
document.write('<input type=hidden name="00N50000001UB3a" id="00N50000001UB3a" value="' + mySplitResult[i] + '">'); 
} 

// Territory 
myString = myTerritory; 
mySplitResult = myString.split(";"); 
for(i = 0; i < mySplitResult.length; i++){ 
document.write('<input type=hidden name="00N50000001VHGC" id="00N50000001VHGC" value="' + mySplitResult[i] + '">'); 
} 

// Products 
myString = myProducts; 
mySplitResult = myString.split(";"); 
for(i = 0; i < mySplitResult.length; i++){ 
document.write('<input type=hidden name="00N50000001UB51" id="00N50000001UB51" value="' + mySplitResult[i] + '">'); 
} 

// Channels 
myString = myChannels; 
mySplitResult = myString.split(";"); 
for(i = 0; i < mySplitResult.length; i++){ 
document.write('<input type=hidden name="00N50000001UMNQ" id="00N50000001UMNQ" value="' + mySplitResult[i] + '">'); 
} 


} 
</script> 

</body> 
</html>