Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

macg's Achievements

Helping Hand

Helping Hand (3/5)



  1. Haha, I had a hunch that might be it. Thanks a lot, it works now ?
  2. I read all the documentation about environment variables, but I still fail to solve my problem. I created a Workflow Environment Variable with the name "API_KEY", added the key as value and checked Don't Export. Next, I created a "Run Script" action (/bin/bash, with input as argv, running instances sequentially) that looks pretty much like this but unfortunately doesn't work. Seems like I use $API_KEY incorrectly because if I replace $API_KEY with the key itself, it works. curl -H 'Authorization: Fooapp-authtoken $API_KEY' https://fooapp.com/api/contacts Hope somebody can clarify, what I'm doing wrong. Thanks
  3. Thx for the clarification @deanishe
  4. Hi, I try to make a POST request in a "Run Script" Action using JS. I tried doing it with fetch() or an XMLHttpRequest but I get errors stating XMLHttpRequest and fetch are undefined variables. I think there's something I don't get about scripting yet and how they work and what we have access to. Hopefully somebody can enlighten me. cheers
  5. @dfay I had checked out that post before and tried the JS solution but got errors all the time. Turned out I was using the wrong variable names. Thought I was using the wrong solution all the time =) @deanishe Thanks, that made it pretty clear what had to be done @Vero I updated my information Thanks a lot for the quick help to all. Here's what I did in the end for anybody who's interested: ObjC.import('stdlib'); function daysInMonth(month,year) { return new Date(year, month, 0).getDate(); } function run(argv) { var items = []; var year = $.getenv('receipt_year'); var month = $.getenv('receipt_month'); var days = daysInMonth(month, year); for (let i = 1; i <= days; i++) { items.push({title: i.toString(), arg: ('0' + i).slice(-2)}); } items = items.filter( item => item.title.indexOf(argv) !== -1 ); return JSON.stringify({items: items}); }
  6. Hi, I'm trying to move beyond simple Keyword inputs and List Filters and set up my first Script Filter. I'm having a hard time though to get started. I'm trying to write the script in JS because that's the language I know best. First of all, I have no idea how to access variables I saved in the steps before the Script Filter. Basically I'm trying to create a simple day select. In the 2 previous steps I save a year and a day variable. In the script filter I want to return a list of 28 to 31 items (title: 1-31, arg: 01-31), depending on the year and month selection. In the script I was planning to use a simple function to get the number of days in a month: function daysInMonth(month,year) { return new Date(year, month, 0).getDate(); } That's as far as I got though. I don't know how to pass the month and year variable (that I entered earlier) into the function. And then I don't know how to create the list of items properly and display them. Hope somebody can help guide into the right direction. cheers
  • Create New...