Created
October 29, 2021 14:48
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screenshot: https://i.imgur.com/bHhv9iA.png