You need to sign in to do that
Don't have an account?
Using S-control to convert Picklist value to text
Below is a direct copy/paste from salesforce.
This can be used for long picklists, or picklist that are often changed. It allows to bring the text value of a picklist into a custom field.
Object on which the control is applied: "Target__c"
Name of the picklist field: "Mill_1_Style__c"
Name of the field on which we copy the value from Mill_1_Style__c: "Right__c"
S-Control:
<html>
<head>
<link
href="/sCSS/8.0/1171411121000/Theme2/default/common.css"
media="handheld,print,projection,screen,tty,tv" rel="stylesheet"
type="text/css" />
<script src="/soap/ajax/8.0/connection.js"></script>
<script>
var FieldLabelofFieldToUpdate = "Right";
function initPage() {
var tarx= new sforce.SObject("Target__c");
tarx.Id="{!Target__c.Id}";
newAmt= "{!Target__c.Mill_1_Style__c}"
resultGo = sforce.connection.update([tarx]);
setTDInnerHTML(newAmt);
document.body.innerHTML = "";
}
function setTDInnerHTML(val)
{
var d = window.parent.document;
var tds = d.getElementsByTagName("TD");
for(var i=0; i<tds.length; i++)
{
if(tds[i].innerHTML == FieldLabelofFieldToUpdate )
{
tds[i].nextSibling.innerHTML = val;
}
}
}
</script>
</head>
<body bgcolor="#F3F3EC" onload="initPage();">
</body>
</html>
So the question remains: Is there a way to use an S-control, to copy a field value from a picklist (or any other field type, such as a result from a formula) to a different field. I want to do this because:
1) Using the picklist operators is annoying and time consuming
2) Because I'm using picklist operators in some of my formulas, and because the picklists I'm using are very long, I'm running into the ceiling for numbers of characters which can be computed (5000 total for formulas which reference other formulas).
Thanks again for your help.
I am struggling with this as well with some very long picklist values.
I would love to see some sample code if anyone has done this with an Apex Trigger (learning myself) or a working S-Control. I am sure that it would be pretty short, right?
Thanks!