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
AtroxyAtroxy 

Create new Record through Button

Heya, I'm trying to create a new new invoice record (custom object) through a button on an Opportunity.

 

I've go the entire the entire thing working with an apex class using webservice, callout and a javascript button. But I now want to create a button, which takes the same actions, just without sending any information outside of Salesforce. So a click on the button should completely create a new invoice object on mouse-click. I've been run into all sorts of trouble, starting that I can no longer using the ajax/javascript button and thus can invoke my class per button.

 

Anybody have some experience with creating a new custom object from an Opportunity, which goes beyond pre-populating a few fields?

Marko LamotMarko Lamot

 I ussualy do that via 

1) custom button (onclick javascript) via java script   (for professional editions)

2) custom button (visualforce page) via apex (for enterprise editions)

 

No problems whatsoever....

AtroxyAtroxy

Heya, what is the use of the Visualforce page inbetween? What does it do, or what is the added benefit?

Marko LamotMarko Lamot
You don't need to bother with java script ;-)


extensions="OpportunityExtensionController" action="{!create_invoice}">


*Marko Lamot, Agilcon d.o.o.*

marko.lamot@agilcon.si
http://www.agilcon.com
Marko LamotMarko Lamot

You don't need to bother with java script ;-)


<apex:page standardcontroller="Opportunity" extensions="OpportunityExtensionController" action="{!create_invoice}">
</apex:page> 
 

Marko Lamot, Agilcon d.o.o.

krprkrpr

Create a Custom URL Button something like this :

 

for ex : {!URLFOR($Action.Opportunity.New, Account.Id, [opp3=Account.Name,conid=Contact.Id] )}

 

Replace Opportunity with Invoice and other fields accordingly.

AtroxyAtroxy

Thanks for all the help, you're probably pointing me in the right direction :-)

 

Now I just need to scramble through this whole Standard Controller Extension stufff I guess. Oh boy....