Intro
Being able to collect user feedback that provides additional color and context to tabular data can dramatically improve its value. In this tutorial, we’ll be building a “Return Flow” app, which allows retail associates to add comments to item-level returns data. You can check out complete code examples of the Return Flow app here.

Step 1: Get the Data
Before we can build an app that lets us add commentary to data, we need to upload our data to a Domo DataSet. In theory, this app could work with any DataSet, but for simplicity we’ll be using the following sample returns data.
| Store Number | Customer Name | SKU | Item Returned | Reason for Return |
|---|---|---|---|---|
| 22 | John Smith | 56789 | Red Sweater | Wrong Size |
| 19 | Jane Doe | 98765 | Blue Jeans | Didn’t Like Fit |
| 35 | Mary Johnson | 12354 | Black Jacket | Wrong Color |
| 17 | Robert Brown | 65432 | White Dress | Wrong Size |
| 12 | Jennifer Miller | 45678 | Gray Scarf | Didn’t Like Color |
| 31 | Brian Williams | 23456 | Purple Top | Wrong Size |
| 11 | Susan Davis | 89765 | Orange Shirt | Didn’t Like Fit |
| 25 | Thomas Moore | 34987 | Yellow Shirt | Wrong Color |
| 26 | Amanda Taylor | 87654 | Green Pants | Didn’t Like Fit |
| 18 | William Thompson | 87456 | Brown Skirt | Wrong Size |

Return Flow Sample, but you can name yours whatever you’d like.

Step 2: Initialize Our App
To generate an initial app template, use the
domo init command from your command line in the directory where you want your app files to live.
You’ll be prompted to:
- Give your app a name
- Select a starter template
- Connect a DataSet
dataset id with the id of your DataSet.

cd command and explore the basic file structure of your App. It should look like the following:

manifest.json file you can see that we have some default configuration set for our app.
thumbnail.png file to use for the App’s icon image in Domo. You can use the image found here.
Once, you’ve added the thumbnail.png file, go ahead and run the domo publish command. This should automatically add the id of the App Design in Domo to your manifest.json file as well as a fileName property.
Make sure your manifest.json file now looks something like this:


h1 element and is successfully wired up to a DataSet with the alias returns, which we’ve set by default to the Return Flow Sample DataSet we setup in Step 1.

Step 3: Explore Default Files
Let’s have a look at some of the default files generated by our starter template. The
index.html file contains the basic structure of our page and loads our JavaScript and CSS assets.
domo.js library provides a number of useful functions for interfacing with Domo, including the domo.get call that is included in our app.js file by default.
returns.
Let’s confirm that this is working by running the domo dev command to launch a hot-reloading local server. You should see a window open in your browser at localhost:3000.

domo.get request is logging data from your DataSet.

Step 4: Add Item CSS
We’ll be using the Bootstrap CSS library to provide some styles that will make the grid data we eventually display look cleaner. The Bootstrap CDN can be found here: https://www.bootstrapcdn.com/ The Bootstrap component documentation here: https://getbootstrap.com/ To pull in the Bootstrap library via CDN, add the following code to the
<head> tag in your index.html file.

app.css file.
Step 5: Update Manifest
Update the App Size
First, we can make our card bigger by editing themanifest.json file’s size property.
Update the DataSet Mapping
Next, the default information for the dataset mapping needs to be updated to include some additional information about the columns that we will be using in the app. Replace thefields array of the dataset in the mapping object:
Configure an AppDB Collection
We also want to define an AppDB collection where we can store data from user input. Define that collection using the below code snippet that can be added after the mapping array:comments with three properties: id, user, and postBody. With the syncEnabled property set to true, this will also automatically sync our AppDB collection to a DataSet in Domo. For more on AppDB see the AppDB API Reference.
There’s just one more update we need to make to the manifest.json file to ensure we can develop locally against our new AppDB collection: adding a proxyId.
You can find the proxyId of your App Instance in the Cards tab of the App Design. Go ahead and copy that id and add it to your manifest.json file.

manifest.json file should now look something like this:
Publish the App
Let’s publish our changes to our App Design in Domo so we can see the new Data Mapping and AppDB Collection reflected there. Stop the local server withCommand-C (Mac) or Control-C (Windows). Then run domo publish.
If you look at your App Design, go to the Card where you App Instance lives, and then click “Edit Card” you can see that the Mapping on the Wiring Screen has changed. You can now select which columns in your connected DataSet map to which column aliases. You should also see a new AppDB collection called comments, which has and empty array of data to start [].

Step 6: Add some boilerplate HTML structure
Start your development server again using the
domo dev command.
Then, replace the <h1> tag in the index.html file with the following code:

Step 7: Fetch Returns Data
Replace the existing
domo.get() call with the following defined async function in the app.js file:
generateRow() which has not yet been defined. Define it below the loadData() function to give your app a way to generate html structure for each row of data returned from the dataset:
loadData() function call to the body onload event in your app.html file like so:

Step 8 Show Comment Section
In the
app.js file add an onClick handler to the button HTML in the generateRow() function as follows.
modifyCommentsContainer() that will set a comment container’s visibility property to true. We need to define that function at the bottom of the app.js file using the below code.
commentsContainer that should be created for each row in our dataset. We need to ensure that this container is defined when generating each row of data. To do this, update the generateRow() function to look like this:
app.css file.

Step 9: Create Comment Data
Modify the
onClick handler for the submit button inside the generateRow() function in app.js as follows:
generateCommentElement() function that will need to be defined as well:
generateRow() function to the following:

Step 10: Fetch comment data
To fetch our comment data, we’ll make a get request to our AppDB collection like this:
loadData() function and pass our commentDocuments to our generateRow() function:
generateRow() function has access to the commentDocuments that were passed in, it will need to filter those documents down to just the documents that apply to that row. Add the following filter expression at the top of the generateRow() function:
filteredComments variable in the badge that shows how many comments that row contains (which up until now has been hard coded to 0):
comments-${index} div:
generateRow() function should now look like this:

Step 11 - Add Avatars
Next we can add avatars to each comment by using the Users API so that we know who made each comment. Update the
generateComment() function as follows.

Step 12: Add Attachments
You can add attachments to your comments using the Files API. Add the following code to the bottom of the
generateRow() function right below the commentsContainer div to give the user the option to add an attachment with their comment.
submitComment() function.
submitComment() function.
submitComment() function to clear out the attachment once the user submits.
submitComment() function should now look like this:
generateCommentElement() function. Update that function so it looks like this:
domo publish one more time to update the App in our Domo instance.

Next Steps
Congrats! You’ve successfully built an App on Domo to be able to add comments to data in a table. You’ve leveraged many of the App Framework APIs (Data API, AppDB API, Users API, and Files API) and should be in good shape to extend the functionality of this App. A few potential improvements you might try to make as a challenge:
- Add loading states
- Create a search bar that filters the list of returns
- Add branding and logos
- Add ability to edit and delete comments
- Dynamically update the comment count after a comment has been submitted