1

I am new in Salesforce and I would like to know how to generate an invoice. I think to different solutions and I don't know if there are possible, time-consuming, difficult...

A service has different steps. The service must be invoiced when the step is "completed". a new record have to be added in the table "Invoice" and a link to the invoice document (PDF or Word format)

For the moment, I think to use the section "Note and Attachment Fields". but perhaps that the object "document" is better...

Invoice Creation: I can use the standard button to create a new record but I would like to create it automatically when the status of the file is changed to "completed" for example.

1.I have read the workflow description but I am not sure that it could be use to create automaticaly a specific record in a table.

2.I have also thought to use a button that could fill in the fields and create the record. I fand information to update field with onclick javascript code. But I don't know how to add a record.

Electronic invoice: how can I generate the invoice in PDF or Word format ? and make it available from the record "Invoice n°10" ? For exemple, the record "Invoice_10" would have an attachment field that contain a link to the document "Inv_010.pdf". The user could open the document from the link.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Carole
  • 21
  • 1
  • 2

3 Answers3

2

You might also consider using the standard quote object for your purpose. It comes with a neat PDF generator that is easy to set up. If you set it up right you can (ab)use the quote functionality for creating invoices related to an opportunity. Customizing the New Quote button would allow you to enable this functionality only after the opportunity is closed (using JavaScript). Regarding MS Word generation I recommend DocMocracy: http://www.cloudgizmos.com/salesforce-sfdc-word-excel-document-generator since it is really cheap and you can create read-only word documents.

Multimann
  • 21
  • 2
1

To answer your first question, you want to write an Apex trigger — run it on your service object (sounds like Opportunity) after insert, and after update, and if the status has been changed to completed then generate your invoice record.

As for generating a PDF invoice you can do this by creating a Visualforce Page and using the renderAs="pdf" attribute in the <apex:page> tag. Storing it against a record will be a bit more tricky, though I suggest you look at examples of how you can attach a Visualforce PDF to an email, you can likely use the same blob object (which stores the content) as a document in Salesforce.

Matt Lacey
  • 8,227
  • 35
  • 58
  • I didn't find how to create a trigger? How can I do this? – Carole Jan 24 '12 at 16:30
  • I find how to create a new record. But I have difficulty to retrieve the current service ID `var service= {!GETRECORDIDS( $ObjectType.Service__c )};` does not work... – Carole Jan 24 '12 at 16:37
  • 1
    I'm not trying to fob you off here, but I think if you read the Apex and Visualforce Developer's Guides here: http://wiki.developerforce.com/page/Documentation#Apex_and_Visualforce you'll find they repay the time taken to read them very quickly! :) – Matt Lacey Jan 24 '12 at 22:33
1

There is already an application: Invoices for Salesforce listed on the Appexchange that automatically creates invoices - records and PDF, straight out of your sales data. The application includes an invoice template editor that gives you complete freedom to design your invoice documents. In addition, the application can automatically deliver the invoices via email, or can group the invoices in files for batch printing in case you need to send them by post or fax.

Check it out: http://www.invoicesforsalesforce.com

Fernando
  • 43
  • 4