Pull/Call the results of a Zapier trigger - zapier

I am trying to pull the results of another trigger (fields) to then be appended to the endpoint for another trigger. Basically trying to get the custom fields. I may also need to rule out any NULL fields. I have used bundle.inputdata before, but not sure if I need to use that or maybe something like bundle.outputData? The trigger is custom_fields.
Here is what I tried:
const options = {
url: 'https://edapi.zyx.com/v1/Subscribers?PageSize=2&Fields={bundle.outputData.custom_fields}',
method: 'GET',
headers: {

It sounds like you're looking to implement Custom/Dynamic Fields.
To accomplish this, you'll want to create a function that makes a request to your endpoint and returns an array of objects like -
[{"key":"field_1"},{"key":"field_2"}]
Add that function at the end of your inputfields array and once we're done listing the static fields, we'll call and load each returned array index as a custom field.
You should be able to parse out any null values in your function as well before returning.
You can get some additional information here -
https://github.com/zapier/zapier-platform/tree/master/packages/cli#customdynamic-fields

Related

How to get the last inserted row via Odata service

Update:
Using ODATA, How to get the last inserted row in /MySet where MySet.Name = "abc".
I do not want to continuously poll the odata service via model.read(). I know attachChange() or attachDataReceived()methods can be use to get notified automaically. But apart from notification, how to get the 'inserted row'. Also My doubt is how to satisfy the following three conditions here : $top=1, $orderby= Date desc and $filter=NAME eq 'ABC'
The only solution I can think of is to get notified by data inserted via attachDataReceived() and then make a model.read() call with the required filters and additional parameters. Although this would result in these additional 'read' calls.
Original Post Below:
Question: How to pass filters in element binding?
Post: I am using odata service for populating my views.
I want to pass certain filters like $filter=NAME eq 'Scott'
Since I want these parameters to be included only when with odata request for a specific ui-element, I want to include them in bindElement()
specifically something like this
var myFilter = new Array();
myFilter.push(new sap.ui.model.Filter("NAME", sap.ui.model.FilterOperator.EQ, 'Scott'));
var myStandardTile = this.byId("__tile3");
myStandardTile .bindElement("/MySet",{filters:myFilter});
But unfortunately this does not works. When I see the 'network' tab in developer console, Filters are not being added with my request.
You cannot. Neither filter nor sorter nor formatter are supported by element bindings. They are only supported by list and tree bindings.

jquery autocomplete dynamic source from data attribute

There is few topics on the same subject, but non completely satisfied me!
I want to define the source of my autocomplete through a data attribute, like so:
<input data-behaviour='autocomplete' data-source='/path/to/source'>
I'm unable to get it programmatically through the source method:
$ ->
$('[data-behaviour~=autocomplete]').autocomplete
source: (req, resp) ->
return $(this).data('source')
Here is a non-working snippet to play with...
EDIT: a workaround I've found is to set it through the create method:
$ ->
$('[data-behaviour~=autocomplete]').autocomplete
create: (event, ui) ->
$(this).autocomplete( "option", "source", $(this).data('source') )
Check this snippet
But I don't really like this approach, I'm pretty sure better can be done
I'm not familiar with coffeescript; the jQuery UI automplete have a source option that allow you to make some custom stuff; in your case you can use the third option (function) using request and setting the response parameter.
Function: The third variation, a callback, provides the most
flexibility and can be used to connect any data source to
Autocomplete. The callback gets two arguments: A request object, with
a single term property, which refers to the value currently in the
text input. For example, if the user enters "new yo" in a city field,
the Autocomplete term will equal "new yo". A response callback, which
expects a single argument: the data to suggest to the user. This data
should be filtered based on the provided term, and can be in any of
the formats described above for simple local data. It's important when
providing a custom source callback to handle errors during the
request. You must always call the response callback even if you
encounter an error. This ensures that the widget always has the
correct state. When filtering data locally, you can make use of the
built-in $.ui.autocomplete.escapeRegex function. It'll take a single
string argument and escape all regex characters, making the result
safe to pass to new RegExp().
Ref: http://api.jqueryui.com/autocomplete/#option-source
Code:
$ ->
thisEl = $('[data-behaviour~=autocomplete]');
$('[data-behaviour~=autocomplete]').autocomplete
source: (req, resp) ->
resp(thisEl.data('source'));
Is only an example you have to implement the filtering pattern.
Demo: http://codepen.io/anon/pen/gjmHn

How to traverse an array in reverse direction in dust.js?

Is there any simple solution, or it can be accomplished only by defining a custom helper?
The best solution is probably to have the server send the array in reverse order to begin with. In most cases, the "Dust way" is to have the server send data in the format that it will be presented by Dust. If you don't have control over how the data is sent, though, you will either need a helper, or you can manipulate the data (using JavaScript) before passing it to dust.render.
var data = getData();
var data.arrayToReverse = reverseArray(data.arrayToReverse);
dust.render('myDustTemplate', data, function(err, out) {
// Show the result.
});
You would need to write the getData and reverseArray methods, but this way you could get the reversed array without a helper.

EventBrite Javascript API restrict user_list_events

Just want to bring back the latest event from our list. Using the JavaScript API, it seems to bring back all events, even those in draft or those completed.
Is there a parameter I can pass to restrict the results, or do I need to do filter it after I get the results?
There is a 'status' object which I could inspect. This is all I'm currently using
eb_client.user_list_events({}, function (response) {
console.log(response.events)
$.each(response.events, function () {
console.log(this.event.title)
});
});
Thanks!
You can use the event_statuses parameter to return live, started, or ended events. These options need to be in a comma separated list without spaces. If you leave this field blank, it will return everything. The “ended” option will only return events that have ended in the past 7 days.
For example:
event_statuses=live,started

jquery UI autocomplete - extended data?

I would like to use Jquery's UI autocomplete but with some additional functions: after user selects suggested item, I would also like to display additional data related with that item (for example if database of contacts are being searched, then I'd like to display contact's email, addres...) in some html element.
Is there a way to accomplish this?
Thanks in advance,
Ile
EDIT:
I'd like to provide more detail description of what I actually need:
When user starts searching contacts, as a result from database I would like to return contact's ID and Full Name. After user selects certain contact, then ajax function is called and it retrieves all details from selected contact using it's ID. But I don't know how to do following:
As a result from database return the ID and Full Name of contact as a JSON result (probably I would find the solution to get the right format, but I don't know how it needs to be passed to Autocomplete script)
How to handle the result data so that I display only full name and ID is used only when certain contact is selected, so that I can retrieve full details of certain contact
Have a look at its events: You can add a handler for the select event and display all your informations once it fires.
You can specify extra data in formatMatch function. The parameter must be some delimiter separated string. Later in .result function , which takes 3 arguments [event, data, formatted], you can retrieve it by splitting the formatted by the delimiter use and populate the required values.

Resources