You need to sign in to do that
Don't have an account?
Stefan
Button on Opportunities to update custom field
This sounds very basic but I can not find an example of how to do this.
I want to put a button on the Opportunity detail page Button Section. When clicked this should set custom checkbox field EmailDistribute_c to true.
(EmailDistribute is linked to workflow to send an HTML email to Account Team, Account owner etc.)
If I understood you correctly, then
Setup-->Opportunity-->Buttons and Links--> Prees New
Create new Detail Page Button as Content Source choose custom s-control(it is your s-control wich set checkbox to true)
Save s-control
Setup-->Opportunity-->Page Layouts
Press Edit on Opportunity Layout. Double click on Detail Page Buttons. Add from aviable buttons your button and save all changes.
S-Control code will look like this
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script language="JavaScript">
var temp= new sforce.SObject("Opportunity");
temp["Id"]="{!Opportunity.Id}";
temp["EmailDistribute_c"]= true;
try
{ sforce.connection.update([temp]);
} catch(e)
{ alert(e)
}
window.top.location.href = "/{!Opportunity.Id}";
</script>
</head>
</html>