Skip to content

Instantly share code, notes, and snippets.

@HarrisonJackson
Last active August 29, 2015 14:27
Show Gist options
  • Save HarrisonJackson/37e43adea85f526f6e21 to your computer and use it in GitHub Desktop.
Save HarrisonJackson/37e43adea85f526f6e21 to your computer and use it in GitHub Desktop.
Common Zapier Code snippets

To use any of these snippets:

1. Set the input for the Code app trigger to pass any field you want to modify as "content":

input

2. Paste the snippet into the Code app input field:

code editor

3. Use the returned output in another trigger:

use content


var prefix = /^yourprefixhere/; // leave the "/^" in the beginning and the "/" at the end
output = [{cleaned: {content: input.content.replace(prefix, "")}}];
output = [{cleaned: {content: input.content.replace(/<(?:.|\n)*?>/gm, "")}}];
@HarrisonJackson
Copy link
Author

  • Date format X to Date Format Y (lots of these)
  • Truncate to first X characters
  • Remove first/last X characters
  • Remove X from a field where X is text I've specified
  • Convert a seconds/minutes/hours field to minutes/hours
  • currency transformation (e.g. cents to dollars)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment