For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
      • Set App Connection
      • Get App Connections
      • Remove App Connection
      • Get Current App Connection
      • Get Current App Connection Resource
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • webflow.getCurrentAppConnectionResource()
  • Syntax
  • Returns
  • Example
  • Designer Ability
UtilitiesApp Intents & Connections

Get Current App Connection Element

Was this page helpful?
Previous
Built with

webflow.getCurrentAppConnectionResource()

Get the element that triggered the App Connection.

Use the webflow.getCurrentAppConnection() method to verify the App Launch location. If the App was launched from the element settings panel, you can use this method to get information on the resource this App was initiated by.

Syntax

1getCurrentAppConnectionResource(): Promise<null | AppConnectionResource>

Returns

Promise<AppConnectionResource | null>

A Promise that resolves to the AppConnectionResource of for the App. If there is not a resource associated with the App, then the Promise resolves to `null1.

Example

This example is for an App written in React. This code would be placed on the editForms page of the App

1React.useEffect(() => {
2 async function onLoad() {
3 // Await the App Connection to determine where the App was launched from.
4 // If the App was launched from an Element with the App Connection 'myAwesomeAppManageFormElement', proceed with additional actions.
5 const appConnection = await webflow.getCurrentAppConnection();
6
7 if (appConnection === "myAwesomeAppManageFormElement") {
8 // Retrieve resource details about the element associated with this App Connection.
9 // The resource provides information on the specific element initiating the App launch.
10 const resource = await webflow.getCurrentAppConnectionResource();
11
12 // Check if the resource exists and is of type 'Element'.
13 // This ensures that the App can act specifically on an element within the Designer.
14 if (resource && resource.type === "Element") {
15 const element = resource.value;
16
17 // As an example, set a custom attribute on the element.
18 // Here, you can call any appropriate API method to interact with the element, depending on your App's functionality.
19 await element.setCustomAttribute("foo", "bar");
20 }
21 }
22 }
23
24 // Execute the onLoad function upon component mount to check the App launch location and take action accordingly.
25 onLoad();
26}, []);

Try this example

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny