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
SueOLearySueOLeary 

Help with passing a picklist value in a custom button

Here is the code I have in the custom button in our QA Sandbox; the button on the case object is called “New CSC Case”.

 

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&{!Case.Device__c}&def_device_id={!ISPICKVAL(Case.Device__c,'')}&RecordType=012A0000000teDM&ent=Case

 

The button is on the page layout for a case and when clicked most of the functionality works correctly: a new child case is created of a different record type, the parent case number is filled in and the correct account value is filled in on the child case based on the value from the parent case.  The section o fthe button formula which isn't working is the part about &{!Case.Device__c}&def_device_id={!ISPICKVAL(Case.Device__c,'')}

 

I'm trying to take the single picklist value for "device" from the parent case and pass it to the new child case in the button.  In the URL for the new child case, I see that the picklist value was copied from the parent case, but it doesn't pass it to the child.  The URL produced when the button is clicked is below.

 

https://cs11.salesforce.com/500/e?retURL=%2F&def_parent_id=500Z0000002PoFe&def_account_id=001A0000002dpzb&2.5&def_device_id=false&RecordType=012A0000000teDM&ent=Case

 

You can see that the value of "2.5" is in the URL which is correct, but that value doesn't pass to the picklist for the new child case.

 

Can anyone please suggest what's wrong with the part of the button formula &{!Case.Device__c}&def_device_id={!ISPICKVAL(Case.Device__c,'')} ?

 

Thanks to all for any ideas!  Happy New Year!

 

Best Answer chosen by Admin (Salesforce Developers) 
Jake GmerekJake Gmerek

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&def_device_id={!Case.Device__c}&RecordType=012A0000000teDM&ent=Case

 

I took out the first case.device__c, you can try that, but I have a feeling that your issue is with how the picklist is recieving your value.  I am not sure, so I would also check and make sure that def_device_id is the correct ID of the field that you are trying to populate.  If that checks out I would create a custom text field so that you can test and see if there is a difference between populating a text field and a picklist field.  Let me know what you come up with and we can go from there.

All Answers

Saurabh DhobleSaurabh Dhoble

You need to pass : def_device_id=Case.Device__c

No need for checking the ispickval.

SueOLearySueOLeary

Thanks so much for your reply.

 

Now the button formula looks like this:

 

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&{!Case.Device__c}&def_device_id=Case.Device__c&RecordType=012A0000000teDM&ent=Case

 

You can see the section I copied in from your reply: def_device_id=Case.Device__c so the full snipet to pass the picklist value is now this

Case.Device__c}&def_device_id=Case.Device__c

 

Sadly though, it doesn't work  the value form the parent case isn't passed to the new child case.  any other suggestions?  I really appreciate your help!!!

Jake GmerekJake Gmerek

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&{!Case.Device__c}&def_device_id={!Case.Device__c}&RecordType=012A0000000teDM&ent=Case

 

Try that and see if it works.

SueOLearySueOLeary

No luck.  I pasted the entire formula in your reply.  Then clicked the button and this URL is produced.

 

https://cs11.salesforce.com/500/e?retURL=%2F&def_parent_id=500Z0000002PoFe&def_account_id=001A0000002dpzb&2.5&def_device_id=2.5&RecordType=012A0000000teDM&ent=Case

 

The relevant section of the URL about device which is produced when I  click the button becomes "&2.5=def_device_id=2.5"  But the value "2.5" is not passed as the value of the device picklist field in the new child case.  Any other thoughts??

Jake GmerekJake Gmerek

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&def_device_id={!Case.Device__c}&RecordType=012A0000000teDM&ent=Case

 

I took out the first case.device__c, you can try that, but I have a feeling that your issue is with how the picklist is recieving your value.  I am not sure, so I would also check and make sure that def_device_id is the correct ID of the field that you are trying to populate.  If that checks out I would create a custom text field so that you can test and see if there is a difference between populating a text field and a picklist field.  Let me know what you come up with and we can go from there.

This was selected as the best answer
SueOLearySueOLeary

OMG!

the caution in your last reply that I'm not using the correct id was the problem!  DOH!  the formula below works!!  I am so happy!!!

 

/500/e?retURL=%2F{!Case.ParentId}&def_parent_id={!Case.Id}&{!Case.Parent_Case_Account_ID__c}&def_account_id={!Account.Id}&00NA0000000jx2b={!Case.Device__c}&RecordType=012A0000000teDM&ent=Case

 

All I needed was the correct id value for the custom picklist field; the correction section is this

 

&00NA0000000jx2b={!Case.Device__c}

 

HAPPY NEW YEAR!!!  thanks to all on this thread!!