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
Aaron HillAaron Hill 

Updating a Picklist Using an OnClick JavaScript Button

I have a custom object called "Invoice" and a button called "Send Invoice" in this object. When it's clicked I use a URL hack to send bring up an email template. Here is the URL hack:
 
location.replace('/email/author/emailauthor.jsp?retURL=/{!Invoice__c.Id}&p3_lkid={!Invoice__c.Id}&rtype=003&template_id=00Xi0000000ioeb&p5=&p24=invoice@elearningmind.com');



Below that I want to put logic so that a couple fields within the view of the object are updated. One field is a picklist value: "Payment Status". The other field is a simple date field that I need to be updated with the day that the cutton is clicked, so I think I need to use TODAY().

My question: can I use merge fields for this or do I have to use an AJAX toolkit? Here is the merge field I was trying to use:
 
{!Invoice__c.Payment_Status__c}  = "Internal Invoice Request Sent";

But when I put it in there, the field does not update at all. If I have to use an AJAX toolkit could you please explain how I should structure it? I was looking at a lot of different examples but I couldn't seem to translate any of them to my situation. Either the page just reloaded without updating or I was given an error. 

Any help would be greatly apprecited. 

Best,
Aaron