You need to sign in to do that
Don't have an account?
Nuvo Mortgages
Custom button to populate fields on opportunity
Hi there,
I'm using the below javascript in a cusom button to update two fields within an opportunity when clicked.
Please can someone help let me know where I'm going wrong?
Thanks,
Ed
I'm using the below javascript in a cusom button to update two fields within an opportunity when clicked.
- The field DIP_Accepted__c is a checkbox - This needs to be set to "True" when the button is clicked
- The field Date_DIP_Accepted__c is a DateTime field - This need to populate with the current Date&Time when the button is clicked.
Please can someone help let me know where I'm going wrong?
Thanks,
Ed
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")} var oppToUpdate = new sforce.SObject("Opportunity"); console.log(oppToUpdate.DIP_Accepted__c); oppToUpdate.DIP_Accepted__c = true; oppToUpdate.Date_DIP_Accepted__c = new Date().toISOString(); sforce.connection.update([oppToUpdate]); window.location.reload();
Your oppToUpdate variable haven't record id, thats why it cannot be updated.
Try to add this row before update the record.