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
Samantha StarlingSamantha Starling 

Can anyone help with some code for a button to update fields (not create new) on Oppty Prod from a custom object?

We have a custom object called Production Details and need three fields from that object to push back onto the related Opportunity Product. I set up an auto-numbering field on the Oppty Prod so each would have a unique identifier in order to match each Production Detail. I created a text field on the Production Detail where the user will input that number. Just for the heck of it, I looked at a WFR first knowing there are limits with Oppty Prod and custom objects and probably not possible. The WFR is set up so that once those two numbers match, the field updates for the three fields would kick in. The forumlas are all working with no errors. I've tried every configuration and still the updates are not happening so back to Plan A for a button. I've looked up and tried several codes for buttons to send the data from the Production Detail object to the related Oppty Product but have been unsuccessful.

Anyone know have code for such a thing or know if it's possible to create a "Send to Oppty Prod" button that will send the data from our Production Detail to the matching Oppty Prod?
MithunPMithunP
Hi Samantha Starling,

It's Possible, Create a custom detail button on Production Detail object. Create Apex class and call it from custom button javascript code.

Here is some samples for creating custom javascript button and calling apex from Javascript code.

http://www.salesforce.com/us/developer/docs/workbook/Content/button_1.htm
http://blog.shivanathd.com/2014/07/call-apex-class-from-custom-button-salesforce.html
http://www.sundoginteractive.com/sunblog/posts/three-reasons-to-use-javascript-and-the-salesforce-api-behind-custom-button

Best Regards,
Mithun.