Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Add code examples and scenarios to the dynamic dropdowns section of the Readme #415

Merged
merged 3 commits into from
Apr 2, 2019

Conversation

robwa10
Copy link
Contributor

@robwa10 robwa10 commented Mar 27, 2019

We regularly get dev-app questions in the T2 queue where they are confused about dynamic dropdowns. This pull request seeks to reduce those tickets by:

  • Restructuring the Dynamic Dropdowns section to walk devs through how to configure them in their own apps.
  • Adding more code examples to the Dynamic Dropdowns section of the Readme.md

Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, so this is a good start!

The biggest thing is that you need to make changes in readme-source.md and then run npm run docs to make those changes in the actual readme. This isn't obvious and i'll make a note in the new issue template to be more clear about it.

Also, any snippets that aren't tiny (< 5 lines) should go in their own file and included via [insert-file:./snippets/app-def.js]

Lastly, it looks like prettier got run on the readme. There was a reason we didn't want that to happen (though I can't currently remember why exactly - something about list spacing, maybe?), but we can keep it if everything looks good.

Thanks a ton for helping with our docs and let me know if any of the above doesn't make sense!

README.md Outdated
```

> Only dropdowns support `altersDynamicFields`.

### Dynamic Dropdowns

Sometimes, API endpoints require clients to specify a parent object in order to create or access the child resources. Imagine having to specify a company id in order to get a list of employees for that company. Since people don't speak in auto-incremented ID's, it is necessary that Zapier offer a simple way to select that parent using human readable handles.
Sometimes, API endpoints require clients to specify a parent object in order to create or access the child resources. For instance, specifying a spreadsheet id in order to retrieve it's worksheets. Since people don't speak in auto-incremented ID's, it is necessary that Zapier offer a simple way to select that parent using human readable handles.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: it's -> its

To define one, you can provide the `dynamic` property on your field to specify the trigger that should be used to populate the options for the dropdown. The value for the property is a dot-separated concatenation of a trigger's key, the field to use for the value, and the field to use for the label.
To define one you include the `dynamic` property on the `inputFields` object. The value for the property is a dot-separated _string_ concatenation.

```js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be moved into a snippet. create a new file in the snippet directory and then replace this block with [insert-file:./snippets/app-def.js]. See this: https://github.com/zapier/zapier-platform-cli/blame/5dffe11f4322466f873f628c50ce8996c5ba44ca/README-source.md#L183

README.md Outdated
};
```

The Google Sheets integration is an example of this pattern.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe link to the zapbook page for sheets here?

README.md Outdated
@@ -1416,8 +1562,8 @@ This object holds the user's auth details and the data for the API requests.

```js
{
createdBy: 'his name is Bobby Flay'
style: 'he cooks mediterranean'
createdBy: 'his name is Bobby Flay';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these semis are incorrect. there should be a comma on the first one though

@robwa10
Copy link
Contributor Author

robwa10 commented Apr 1, 2019

@xavdid thanks for guiding me through that process and those great suggestions in the review. I've made those and hopefully nothing extra happened this time round. My editor auto ran Prettier on the Readme last time. I've changed that setting now.
Let me know any other changes you see or other parts of the process I missed!

Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, thank you! prettier is usually a good thing (I ❤️ it) but just in this specific case, it did had weird behavior.

In any case, thank you! feel free to merge at your convenience.

@robwa10 robwa10 merged commit 87303f2 into master Apr 2, 2019
@xavdid xavdid deleted the readme-dynamic-dropdowns branch April 4, 2019 21:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants