# Is There A Way to Submit A Modal Form Without Having to Attach a Resource

**URL:** <https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782>\
**Category:** App Components\
**Created:** [2 August 2024 20:35 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782 "2024-08-02T20:35:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [2 August 2024 20:35 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/1 "2024-08-02T20:35:36Z")

</div>

Sorry if this has already been answered elsewhere: I just couldn’t find anything that really answered the question.

We have a private app that uses modal forms to generate project tasks based in a similar way that a template would (we quickly found out we would need far too many project templates to be practical or manageable), to require necessary information to minimize digging for information, and to propagate critical information across all tasks in the project without having to switch between screens. It’s worked wonderfully for us so far, and I’ve been working on some quality-of-life improvements. I’m running into the same annoyance I had when I was first building the app that modal forms require an attachment to be sent back on submission to avoid an error. We have no use for them, and I’ve ended up just dropping in project information pages no one will ever bother looking at all over the place every time a form is used.

I’ve tried returning a resource name like a message with a null resource URL. I didn’t have high confidence, but I figured I’d give it a try. Is there no way to return something like an { action\_result: “ok” } (tried this too) like you can with webhooks, or am I just stuck with a pile of pointless links cluttering up my activity logs?

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [3 August 2024 05:20 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/2 "2024-08-03T05:20:38Z")

</div>

It’s been a few years since I learned the ins and outs of App Components, so I’m struggling a bit to remember.

Are you using a modal form in conjunction with displaying a widget on the task, or no? If not, what’s the context in which you’re displaying it?

---

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [5 August 2024 13:57 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/3 "2024-08-05T13:57:06Z")

</div>

No, we really don’t need the widgets. We’re pulling a form from any task, filling out the form, and then working in the tasks it generates.

 ![Pull the form from the Get Form option next to the app name](https://us1.discourse-cdn.com/asana/original/3X/6/c/6c6e3f28689932d5ba7d190a2c80f49743046141.png)  
 ![Intermediate form to pull a form with options specific to type](https://us1.discourse-cdn.com/asana/original/3X/0/b/0b054cf9ae75d877ece05a3df97e38d7fd2458e2.png)  
 ![Specific form](https://us1.discourse-cdn.com/asana/original/3X/c/9/c94684636118c6707b0b934450a30be613f13685.png)  
 ![Tasks generated with tags and custom fields filled in. Link to a show page added to the original task.](https://us1.discourse-cdn.com/asana/original/3X/f/3/f3f896426f5d1d450e2110952767dd86526fc371.png)

I don’t need that Show Page link in there, but I’m forced to return some kind of attachment when the modal form is submitted in order to avoid returning an error.

---

<div class="post-metadata">

**Author:** ![John\_Vu](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/john_vu/32/97235_2.png) [@John\_Vu](https://forum.asana.com/u/John_Vu)\
**Post date:** [6 August 2024 01:10 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/4 "2024-08-06T01:10:12Z")

</div>

Hi @Kariah_Petrille,

Unfortunately our API requires that you send an attachment response when we make a call to your app server’s [On submit callback](https://developers.asana.com/reference/onformsubmit) endpoint. Hence why we marked it as required in our docs:

 ![require_attachment_response](https://us1.discourse-cdn.com/asana/original/3X/d/3/d3c2e8af01d0fd1ddfd6fa4633aebc397b14bb11.png)

The reason for this is because the modal form and widget are tied to the attachment.

That being said, when we make an API call to your app server’s [On submit callback](https://developers.asana.com/reference/onformsubmit) endpoint we send an attachment ID in the POST request body that you can use to look up the story on the task ([Get stories from a task](https://developers.asana.com/reference/getstoriesfortask)) that has the attachment on it and delete that story ([Delete a story](https://developers.asana.com/reference/deletestory)).

NOTE: this is a documentation bug we should have `attachment` shown under the **“Body Params”** section of our [On submit callback](https://developers.asana.com/reference/onformsubmit) endpoint

EX: `req.body` of Asana’s API call to your app server’s [On submit callback](https://developers.asana.com/reference/onformsubmit) endpoint:

```javascript
{
  data: '{"attachment":123,"user":456,"workspace":789,"expires_at":"2024-08-06T00:58:54.770Z","values":{"single_line_text_full_width":"","single_line_text_half_width":"","single_line_text_full_width_is_watched":"","multi_line_text":"","rich_text":"<BODY></BODY>","dropdown_half_width":"","dropdown_full_width":"","radio_button":"1"},"task":91011}'
}

```

You can take the `"attachment":123` → `123` response and make a call to [Get stories from a task](https://developers.asana.com/reference/getstoriesfortask) endpoint to get the stories on the task. Then filter for the story that has the attachment on it and call [Delete a story](https://developers.asana.com/reference/deletestory) endpoint.

NOTE: for your [Get stories from a task](https://developers.asana.com/reference/getstoriesfortask) you’ll probably want to specify `html_text` for `opt_fields` since the content from the `html_text` will contain the `attachment_gid`

Example response from request to [Get stories from a task](https://developers.asana.com/reference/getstoriesfortask) with `html_text` in `opt_fields`

```json
{
    "data": [{
        "gid": "789",
        "html_text": "<b><a href=\"https://app.asana.com/0/profile/456\">Demo</a></b> attached <a href=\"https://app.asana.com/app/asana/-/get_asset?asset_id=123\">I'm an Attachment</a>"
    }]
}

```

---

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [6 August 2024 14:38 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/5 "2024-08-06T14:38:34Z")

</div>

Thanks, John! I think that will be a quick fix to the problem.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [6 August 2024 16:11 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/6 "2024-08-06T16:11:58Z")

</div>

Not 100% sure but my memory tells me the reason an attachment is required is that the modal form was designed to really work in conjunction with setting up a widget on a task, and the attachment is what tells Asana to display the widget. @John_Vu am I remembering that accurately or no?

---

<div class="post-metadata">

**Author:** ![John\_Vu](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/john_vu/32/97235_2.png) [@John\_Vu](https://forum.asana.com/u/John_Vu)\
**Post date:** [6 August 2024 18:03 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/7 "2024-08-06T18:03:34Z")

</div>

@Kariah_Petrille . @Phil_Seeman made a good point. I did some experimentation and it looks like what Phil said is true. The modal form and widget is tied to the attachment which makes sense why we require the attachment response for [On submit callback](https://developers.asana.com/reference/onformsubmit). I also confirmed this with our team. I’ll fix my previous answer.

@Kariah_Petrille instead of deleting the attachment, I would delete the story that mentions the attachment instead.

See the video’s I’ve linked for the behavior:

- Deleting Story: [deleting\_story.mov - Google Drive](https://drive.google.com/file/d/15i9bu7ybrIjkPem7Nb2Ulxs0rn0rUvC2/view?usp=sharing)
- Deleting Attachment: [deleting\_attachment.mov - Google Drive](https://drive.google.com/file/d/1YfLRdoLUskiANR6DIOfboZClalHp0wge/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [6 August 2024 18:24 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/8 "2024-08-06T18:24:31Z")

</div>

Since we’re not using the widgets at all, would there be any practical reason for doing it this way? What it’s returning is a throw away webpage as an attachment. If we were using the widgets, I see this would probably cause a host of problems, but we really have no need to display data like this, and I don’t see any time in the next few years where we would.

The problem that made me bring this up in the first place is that there is no simple way to identify which story it is that needs to be deleted until after the process is done, requiring me to go back and sort through all the stories on a task to find the one I need. There may be just the one, or there may be a dozen. There also aren’t any other UI options that can fulfill the same function as this one is able to even if this isn’t what it was necessarily designed to do.

---

<div class="post-metadata">

**Author:** ![John\_Vu](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/john_vu/32/97235_2.png) [@John\_Vu](https://forum.asana.com/u/John_Vu)\
**Post date:** [6 August 2024 18:44 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/9 "2024-08-06T18:44:20Z")

</div>

Hi @Kariah_Petrille, it seems like you just want to use the app component modal form to add the functionality to fill out a form on a task and don’t care about the widget or the association of the modal form being filled out to the task. If that’s the case you could probably just delete the attachment. In other words, you are ok with deleting the attachment and if the user de-auth your app and re-installs the app again they won’t see anything associated with the form they previously filled out for the task that had the app component attachment on it.

If you however, want the form being filled out to be associated with the task and don’t want the story to be there you would have to delete the story.

---

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [6 August 2024 18:51 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/10 "2024-08-06T18:51:43Z")

</div>

There’s stuff saved on the server that changes the form, but it’s associated with the project as a whole and not the task requesting the form. Project data isn’t specific to the user, so de-auth shouldn’t affect it.

---

<div class="post-metadata">

**Author:** ![John\_Vu](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/john_vu/32/97235_2.png) [@John\_Vu](https://forum.asana.com/u/John_Vu)\
**Post date:** [6 August 2024 20:13 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/11 "2024-08-06T20:13:13Z")

</div>

I see, so your app server changes the form based on the project and doesn’t care about the form being associated with the task. Thanks for the explanation. This is unique use case to solve with app components but it seems like you figured out a way to use it that’s best for you workflow.

---

<div class="post-metadata">

**Author:** ![Kariah\_Petrille](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/kariah_petrille/32/261612_2.png) [@Kariah\_Petrille](https://forum.asana.com/u/Kariah_Petrille)\
**Post date:** [7 August 2024 13:56 UTC](https://forum.asana.com/t/is-there-a-way-to-submit-a-modal-form-without-having-to-attach-a-resource/880782/12 "2024-08-07T13:56:23Z")

</div>

It’s basically a replacement for a bunch of project templates to make it more manageable to keep up with when things change + a way to guarantee that all needed information gets put in and ends up where it needs to be.
