You need to sign in to do that
Don't have an account?
digitalpixman
Passing Multi-Select Picklist in S-Control
How do you pass values of a multi-select pick list in a basic S-Control? Here's my S-Contol:
/a0A/e?CF00N60000001Uy6X={!SessionTEST__c.Client__c}&CF00N60000001UxIh={!SessionTEST__c.Opportunity__c}&00N60000001Uxyd="1"&00N60000001UxyY={!SessionTEST__c.Pose__c}
The code in red is refferences a multi-select picklist, and the values are displayed in the resulting URL:
https://na4.salesforce.com/a0A/e?CF00N60000001Uy6X=Blue+Mountain+Middle+School&CF00N60000001UxIh=Blue+Mountain+Middle+School+Test+Fall+Portaits&00N60000001Uxyd=1&00N60000001UxyY=Puzzle%3BFamily
However, the values "Puzzle" and "Family" are not written to the field.
What am I doing wrong?
/a0A/e?CF00N60000001Uy6X={!SessionTEST__c.Client__c}&CF00N60000001UxIh={!SessionTEST__c.Opportunity__c}&00N60000001Uxyd="1"&00N60000001UxyY={!SessionTEST__c.Pose__c}
The code in red is refferences a multi-select picklist, and the values are displayed in the resulting URL:
https://na4.salesforce.com/a0A/e?CF00N60000001Uy6X=Blue+Mountain+Middle+School&CF00N60000001UxIh=Blue+Mountain+Middle+School+Test+Fall+Portaits&00N60000001Uxyd=1&00N60000001UxyY=Puzzle%3BFamily
However, the values "Puzzle" and "Family" are not written to the field.
What am I doing wrong?
Just had this problem as well - %3B is url encode for ";", however, the page will only pick up the first value.
To fix, need to check for every value avail in the multi-select & include a param for every value selected. For Example:
/a0A/e?CF00N60000001Uy6X={!SessionTEST__c.Client__c}&CF00N60000001UxIh={!SessionTEST__c.Opportunity__c}&00N60000001Uxyd="1"&00N60000001UxyY={!IF(INCLUDES(SessionTEST__c.Pose__c, "Puzzle"),"Puzzle","")}&00N60000001UxyY={!IF(INCLUDES(SessionTEST__c.Pose__c, "Family"),"Family","")}&00N60000001UxyY={!IF(INCLUDES(SessionTEST__c.Pose__c, "OtherVal"),"OtherVal","")}
Obviously not ideal as this doesnt scale automatically if you make adjustments to the multi-select,
but best i can come up with.
Jhenny,
I have a similar problem and after searching I came across an S-Control that is meant to loop through the multi-picklist values and format them in the URL. However, it all works except for the multipicklist formatting. Essentially what I'm doing is creating a list button on
AccountOpportunity that is used to create a Contract. The button is controlled by an S-control. Can you, or anyone else see what is wrong with the attached code. From various postings I'd say this will prove useful to many people if it can be made to work:<html>
<head>
<title></title>
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/10.0/connection.js"></script>
<script>
var FromPickListField = escape("{!Opportunity.Service_Levels__c}");
var ToPickListFieldName ="00N20000001q7gW";
var pairs = FromPickListField.split(";");
var Fields = ""
for (var i=0;i<pairs.length;i++)
{
var ThisValue = pairs[i]
Fields = Fields + ToPickListFieldName+ "=" + ThisValue + "&"
}
var URL="/800/e?retURL=%2F{!Opportunity.Id}&ctrc7_lkid={!Account.Id}&ctrc7={!Account.Name}&CF00N20000001q2lR_lkid={!Opportunity.Id}&CF00N20000001q2lR={!Opportunity.Name}&ctrc15=Draft&" + Fields
URL = URL + "&" + Fields
parent.frames.location.replace(URL);
</script>
</head>
I changed one line to remove the escape function and it works fine now.
<html> <head> <title></title> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/10.0/connection.js"></script> <script> var FromPickListField = "{!Opportunity.Service_Levels__c}"; var ToPickListFieldName ="00N20000001q7gW"; var pairs = FromPickListField.split(";"); var Fields = "" for (var i=0;i<pairs.length;i++) { var ThisValue = pairs[i] Fields = Fields + ToPickListFieldName+ "=" + ThisValue + "&" } var URL="/800/e?retURL=%2F{!Opportunity.Id}&ctrc7_lkid={!Account.Id}&ctrc7={!Account.Name}&CF00N20000001q2lR_lkid={!Opportunity.Id}&CF00N20000001q2lR={!Opportunity.Name}&ctrc15=Draft&" + Fields URL = URL + "&" + Fields parent.frames.location.replace(URL); </script> </head>
I'm looking for a custom button or s-control that will select all of the items in a dependent picklist when the user clicks on the button. Your example seems to do what I'm looking for.
How would I implement this on a SF page? I have absolutely no experience in SF programming, but I do know javascript, html, etc.
BillAtPar,
When you say select all the items in the picklist, do you mean select the values chosen by the user already and then pass these values onto another field? Because that is what the code in this post does. I have a custom button that uses the S-Control to create a new Contract from an Opportunity record. Upon clicking the button, the user is taken to the Contract edit page and several fields, including one multipicklist, are filled in with values from the Opportunity page.
The code will work with any picklist field with minor modifications. You'll need to get the field ids for your Taget page field to map the picklist values from you Source Page field.Use these values to modify your url string in the code.
Steve
"When you say select all the items in the picklist, do you mean select the values chosen by the user already and then pass these values onto another field?"
No, that's not what I meant.
The behavior of the button would be the same as if the user manually selected all items in the picklist and then clicked on the picklist > button. In other words, the button would do the selecting of the items for the user.
We want to do this to insure that all items in the picklist are always selected. I understand that this could probably be achieved with validation code, but I have been asked to provide this functionality by using a button.
Steve, Thank you for your help.
As I mentioned, I have no experience with S-controls at all. Can you recommend a good source for a beginner's tutorial?