You need to sign in to do that
Don't have an account?
S-control to populate custom picklist field on task
I have a s-control button that creates a new task when clicked. I also want it to auto populate a custom picklist field when the task is created.
The code I have written is below, does anyone know what code I need to include to populate a custom field via this s-control? If this is not possible do you have any other suggestions?
/00T/e?followup=1&title=Call&retURL=%2F{!Contact.Id}&who_id={!Contact.Id}&what_id={!Account.Id}&tsk5=Left+Voice+Mail&tsk6=Left+a+voicemail+for+{!Contact.Name}
&tsk5_fu=Give+{!Contact.Name}+at+{!Account.Name}+a+followup+call&tsk4_fu={!TODAY()+2}&save=x
Also, is there any specific reason I would want to do this with apex code rather than an s-control, if so any tips on how to get started. I have yet to implement any serious Apex code.
Thanks!
Use describeSObject for retriving all the pictlist value in your scontrol.
e.g
var objects = new Array();
objects.push("task");
sforce.connection.describeSObjects(objects,getCallBackObject());
If you want to populate a custom field through the URL then you will need to find the ID of that field. If you look at the source code you will see the field name will be the 15 digit ID that Salesforce uses. Some times they include a CF at the beginning but I have not figured out the logic for this, some have it and some do not.
Apex will allow you to create and save the record without having to have the browser do the work. This means that it will not be controlled by permissions or be delayed by any transmission time. The s-control will rely on the browser to do what you want so it will take time translating between the SF system and the user's computer.
I hope this helps explain the reasons to use Apex, if not then please let us know specific questions and we should be able to answer.
One reason you would want to drop to an Apex and Visualforce solution to this requirement is to avoid having to re-test and validate this solution with each release (including patch releases). Another reason is that an apex/visualforce solution will be easier to maintain and debug. Additionally you can add more logic to the process like conditionally setting the due date based on the user's task load (or vacation schedule). You could also add translation support to this example more easily with apex & Visualforce than with an scontrol or pure URL based solution.
For your reference I've converted your parameterized URL which counts on salesforce.com not changing things like "tsk5" as the form parameter for task subject to one which relies on parameter names of your choosing and an "API" that you maintain.
The custom button/link URL would look like this:
Which would call a Visualforce page named taskcreate with code that looks like this:
Adding custom fields to this approach is simply a matter of adding relevant assignment to either or both of the task objects in the doCreate action method (call, followup) in the same manner as the standard field values are set, i.e. call.subject, followup.subject, etc.
If you want to try this out in your developer account, you'll need to create the apex class first.
Any suggestions?
Hi Crystal,
could you please provide your mobile number or mail as i also stuck with the same problem.
its very urgent requirement.
your help will sincerely appreciated.
Thanks in Advance
my email id is rpothadi@take-es.com
Hi John,
I need to populate the Email and phone number from leads object in to the new task page.
upon clicking the new task button under the open activities in the leads form,needs to display those email and phone number in the task page.
pls tell me how can this be possible.
your quick response will be highly appreciated.
Thanks in Advance.
Here is my email id rpothadi@take-es.com