Skip to content

Instantly share code, notes, and snippets.

@Garconis
Created October 29, 2021 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/3d875da3c0ced9174f1286387cae65e7 to your computer and use it in GitHub Desktop.
Save Garconis/3d875da3c0ced9174f1286387cae65e7 to your computer and use it in GitHub Desktop.
Zapier | Check if field exists or has value, then change the output value if it does or doesn't
// this is wrapped in an `async` function
// you can use await throughout the function
// just in case, initially we set the output of this object to be false
output = {clientIdResult: false};
// get the variable from the inputData we added to this Action
var clientid = inputData.clientId;
// check if the variable had data
if(clientid) {
// if it did, output this content with the variable
output['clientIdResult'] = 'https://analytics.google.com/analytics/web/#/report/visitors-user-activity/a7891781w50370125p50966238/_u.date00=19990101&_u.date01=29990101&_r.userId=' + clientid;
}
// otherwise it didn't have any data
else {
// so we specify a different output for the value
output['clientIdResult'] = 'NA';
}
@Garconis
Copy link
Author

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