Use Case
Custom Field (checkbox - default unchecked): Enrollment_History_Trigger__c
This Enrollment History Trigger field is a hidden field that would be used to trigger a Process; I would like to create a button for our users that updates this field to make it TRUE, which would trigger the Process to run. The end of the Process would then set the field back to FALSE, which should close the loop.
I can't seem to find a way to create a custom button that allows me to change a custom field. Any help here would be appreciated!
4 réponses
The easiest way is to use a JavaScript button like this -
- Setup | Customize | Contacts | Buttons, Links & Actions
- New Button or Link
- Label it say: Start Process
- Display Type: Detail Page Button
- Behaviour: Execute JavaScript
- Content Source: OnClick JavaScript
- JS:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}try{ var contactToUpdate = new sforce.SObject("Contact"); contactToUpdate.Id = "{!Contact.Id}"; contactToUpdate.Enrollment_History_Trigger__c = true; var updateResult = sforce.connection.update([contactToUpdate]); if(updateResult[0].success === "true"){ location.reload(); } else{ alert(updateResult[0].errors.message); }}catch(e){ alert(e.message);} - Save it
Place it on the Detail Page and that should do it! Remember that uses must have
API Access Enabled to use this button as behind the scenes it uses the Partner API to initiate the Update.