Which is the snippet code for this workflow?

Which is the snippet code for this workflow?

Hi, we want to create the following workflow:
1. When a quotation is created and the status changes to "ACCEPTED", then...
2. ....auto create a Sales Order with satus "CONFIRMED", or "NOT CONFIRMED" it doesnt matter
3. Then, after the Sales Order is created in whatever status, auto create its correspondent Invoice in Status "DRAFT" (not digital stamped)

Via support they told me that this workflow is possible to work, but I'm not sure which is the proper code. Trying to find out by myself and with all my ignorance by using IA, it gave me a snippet, but it doesn't work. It is my understanding that after creating a personalized function I have to add it to the workflow as the consequence of the trigger.

Thanks in advance and excuse my bad English. Greetings from Mexico!

                            Zoho Desk Resources

                            • Desk Community Learning Series

                            • Digest

                            • Functions

                            • Meetups

                            • Kbase

                            • Resources

                            • Glossary

                            • Desk Marketplace

                            • MVP Corner

                            • Word of the Day

                                Zoho Marketing Automation

                                        Manage your brands on social media

                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources

                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources

                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources

                                                            Zoho Sprints Resources

                                                              Qntrl Resources

                                                                Zoho Creator Resources

                                                                  Zoho WorkDrive Resources

                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series

                                                                      • Tips


                                                                      • Functions


                                                                      • Meetups


                                                                      • Kbase


                                                                      • Resources


                                                                      • Digest


                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now