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
DFDF 

S- control snipet to update a checkbox

Can some one please help me out, I am having trouble figuring out how to create this.
 
I need an S-control  to set a checkbox value to true when call log pick list value is set and call log is saved.
 
Any help is greatly appriciated.
 
Thank you in advance.
werewolfwerewolf
Is the checkbox value on the call log itself?
DFDF
the check box is on the Lead page


Message Edited by DF on 05-21-2008 02:43 PM
werewolfwerewolf
You probably want to make an Apex trigger, not an Scontrol.  The Apex trigger would be on Task, probably on before insert and before update.
DFDF
How would I accomplish that?
werewolfwerewolf
Have a look at the Force.com Cookbook for some how-tos and samples.  The code itself will be much simpler than an Scontrol would be, although the trigger may be harder to deploy.
DFDF

Can some please help me out, im trying this code for the trigger, cant seem to get it to work.

I am getting this error

Expression cannot be assigned at line -1 column -1

Code:
trigger Invalidphone on Task (before insert, before update){
if (Trigger.isBefore) {for (Task TSK : Trigger.new) {
if( TSK.Call_Success__c.startsWith('invalid phone')){ Lead.Invalid_Phone__c = true;
}
}
}
}

 

werewolfwerewolf
Well for one thing you're referring to a non-variable there.  What is Lead.Invalid_Phone__c?  Apex has no idea which lead you're talking about there.

You need to query for a specific Lead object (probably the one referred to by the task), set the Invalid_Phone__c on that, and update it.  And don't do that query in the context of the loop btw, that's a recipe for problems.

You'll probably want to post future Apex questions on the Apex Code board instead of this one.