DEV Community

Derrick Sherrill for WayScript

Posted on

Automatically Generate Customer Receipts upon Form Submissions


Creating and managing effective business depends on how you manage different tasks. And the more automated are tasks, the more it will be easier for you to focus on the real work.

Today using WayScript, we’ll create a script to automatically generate receipt when a form is submitted.



We want to generate the receipt when a form is submitted. WayScript has Form Trigger integration you can use to create forms with different fields, make it public, and receive submitted information as JSON.

Add it as a Trigger.

Adding From Trigger

The next step now is to configure the fields we’ll use. To keep things simple for this tutorial, I decided to use just three inputs: The technology your client wants (Ah yes! Here, we are acting as a web development agency :D ), the existence of a logo, and his email address.

Well, here we go.

Technology :

Technology input


Logo input


Email input

We have the fields of our form configured, now turn on the trigger and visit the page.


Why using Python here?

Well, we have to process the JSON output we’ll receive and make comparisons and operations. This can be done using JavaScript, Java, or even WayScript modules.

Add the Python module.

Adding the module

Now, click on edit the code, and replace the existing Python Code with this.


So basically, we are retrieving the value of keys in the variables dictionary and performing comparisons to calculate the fees.

Then we register a variable fee in the variables dictionary of WayScript, so we can access it in other modules.

Send Receipt

We’ll use SendEmail to first, send to us the receipt.

Add Send Email module.

Adding Module

Once you’ve added the module, let’s enter the Email Subject and the body of the email.

Email Body

Great. Now, be sure the trigger is activated and make a test. And check the logs.


Questions about this script or anything else? Join our Discord. We're always around to help. If you want to work with the full script template, just find it here

Top comments (0)