+ Start a Discussion
Lee SinLee Sin 

Custom Button URL Hacking Missing Field Name

I am trying to pre-populate a picklist of 'calltype' by using URL hacking.

I have a Replated List of Contacts on Account Layout.

On the Related List, I have a custom button for creating new Activity.

The behavior of the botton is Exucute JavaScript.

I am using URLFOR method to create the url.

In the parameters list,  I am trying to add a default value for the picklist of filed 'calltype'.

I lookedup the ID of that picklist from pagesource to be '00NC0000005FPzF' but it shows error "missing field name" when I checked syntax.

So I tried other ways:

CF00NC0000005FPzF='NML',     no error but the picklist is not prepopulated
Task.00NC0000005FPzF='NML'   no error but the picklist is not prepopulated
NC0000005FPzF='NML',     no error but the picklist is not prepopulated

Why other fields all have names and ids  like 'tsk5' in the pagesource but only calltype  has name and id like '00NC0000005FPzF'?

here's my Js codes:

var recordIds = {!GETRECORDIDS($ObjectType.Contact)}
if(recordIds.length > 1) {
  alert("You must choose no more than one contact to record this voice mail.\n\nPlease check a box next to a contact and try again.")
{ var retURL = "/001";
  var links = document.getElementsByTagName("a");
  for( var ctr = 0; ctr < links.length; ctr++ ) {
  var href = links[ctr].href
  if( href != undefined && href.match(/\?(fcf|lsr)=/) ) {
    retURL =href
var finalHref = "{!URLFOR($Action.Activity.NewTask,null,[what_id=Account.Id,Activities.00NC0000005FPzF="NML",tsk5="NML",tsk12="Completed",tsk4=TEXT(MONTH(TODAY())) &"/" &TEXT(DAY(TODAY())) & "/"&TEXT(YEAR(TODAY()))],true)}"
finalHref = finalHref.replace(/retURL=[%\w\d]+&?/,'')
retURL = escape(retURL.replace(/https?:\/\/.*\.com/,""))
finalHref += (recordIds.length==1?("&who_id="+recordIds[0]):"")+"&retURL="+retURL
  window.top.location.href = finalHref

Hi , 

Changing the Salesforce Object ID will not help as it is auto generated and cannot be altered or modified for some other related value - that is completely Unique. 

You can use the get set method via the visualforce page on the javascript action, 

VisualForce Page :
<apex:selectList value="{!PicklistValue}" size="1"  >
<apex:selectOptions value="{!Picklist}"  />

You can populate a picklist field simply by assigning the picklist value string to the field.

t.Status = 'Updated Value';

You can also use a simple workflow to update the field as well. 

See the below links for further information,