We have custom app components that are working correctly. When I create an attachment as a user via the lookup, the widget renders beautifully.
When I create the attachment via the API with exactly the same view_url it does not render as a widget, showing up instead as a regular attachment.
My API call to create the attachment includes the property “connect_to_app” set to true.
When I use the API to look at the two attachments (the one a user creates via the lookup and the one the API creates) they are identical, ironically including a read-only property called “connected_to_app” which is false in both cases.
As far as I can tell, this is an Asana API bug and there is no way via the API to create an attachment that correctly renders as a widget.
Can anyone say otherwise? Is anyone else having this problem?
While I think @Bastien_Siebman was able at one point to have an App Component widget display properly by manually adding an attachment, my understanding is that’s not supported or the way App Components are designed to work. The supported way is by using the Lookup and letting Asana create the attachment for you - which it sounds like you’re already doing correctly. My understanding is that App Component don’t support manually adding the attachment.
(@John_Vu@John_Baldo please correct anything I said above that’s not accurate.)
No, they don’t need to explicitly attach anything; they use the supported Lookup/Widget methods I’m describing, which add an attachment in the background in the process.
An App Component should never even have to be concerned that there is an attachment. It’s designed to be an internal way for Asana to keep track of the fact that there’s a connected app on the task. That’s the way App Components were explained to me by the Asana devs when they were first created.
So if I understand you correctly, there is no way for an app component to be connected to a task other than via the UI since the lookup script cannot be activated programmatically.
In the way that App Components were designed, yes, that’s 100% correct per my understanding.
Having said that, I’m pretty sure @Bastien_Siebman figured out how to explicitly add an attachment which fooled Asana into considering it as an App Component on that task, didn’t you, Bastien? If so, maybe you can share the code you used to do that?
@Bastien_Siebman i had the same misunderstanding as you. There must be some documentation implying or stating that attachments with a url that matches the app component regex attach, at least when the connect_to_app (or connected_to_app) property is true.
It also begs the question what are those properties for?
@Steve_Robinson
I don’t think the App Component documentation is that great - it could definitely be clearer. But take a look at it here: App components on tasks
Note:
App components on tasks are initiated with the entry point. The entry point can open either a modal form or a lookup . Typically the modal form is used to create a new object or 3rd party resource (like a Zoom meeting) and the lookup is used to attach an existing 3rd party resource (like a Jira issue).
This comports with what I’ve said above. Note there is nothing in those docs about explicitly attaching anything to a task. The only thing it says about attachments is
How does Asana determine when a widget should be shown? When a task is opened in Asana, it checks each attachment on the task. If an attachment has a URL that fits with an app’s registered match URL pattern (ex: https:\/\/.*.atlassian.net\/.* ) then it shows a Widget.
What is doesn’t say there but I guess it should is “Asana will create this attachment when you use the above entry points to create the App Component on that task”.
The problem I have is that I want to bulk add a widget on all tasks in a project, and you are basically saying it won’t happen unless someone goes through a modal form… That’s weird…
I’m in the same boat. I need all tasks to have the appropriate attachments for further processing downstream (in our case, we’re accounting for time on the tasks), but I only want humans adding the widget when there’s insufficient logic for the other system to do it.
Again, if it’s not possible, I’m really confused about what the connect_to_app property means when creating an attachment.
@Bastien_Siebman@Steve_Robinson
Believe me, I totally get your use case; it’s just not what App Components were designed or built for.
They were designed and built for one use case: where there is a specific external object, like a Zoom meeting or a Jira issue or a Salesforce opportunity, and you want to pair or link that object with a specific Asana task.
Asana initially built App Components as an internal solution to support building integrations like the ones mentioned above. Then they said, “Hey, you know what, why not expose this architecture so other third parties can also use it to link their external objects with Asana tasks?”
You can try to use it outside this scenario, like trying to programmatically create a widget; but I think you’re on your own for that since it’s not a supported use case.
(@John_Baldo@Kem_Ozbek please jump in here if anything I’ve said is incorrect or needs clarification.)