How to embed an external form module in a Sapho micro app page
Category: Sapho App
With the release of Sapho Employee Experience Portal 4.9, you can now embed a page from a separate web application running on the same application server.
This allows you to provide your users with more complex, use-case specific forms and workflows in Sapho without being limited by the Sapho platform.
Sapho provides a simple Java integration module which handles the authentication, authorization, and interaction of embedded Sapho micro apps. The module is framework-agnostic, so that your application can focus on handling business logic using any framework, as long as the resulting web application can be deployed as a standalone WAR archive.
To embed the form, you'll need to go through several steps:
- Set the environment variables:
- Deploy your form application WAR file to the context root defined by SAPHO_EXTERNAL_FORMS_ROOT_URL environment variable to the same application server where Sapho is deployed in root context.
- Integrate Sapho’s forms-integration module to authenticate and authorize a user, get a username, email, display name and IdP groups, and to invoke button actions on a micro app embedded page.
- Please note the URL, relative to the context root, where your form is accessible. Your app can expose multiple forms on separate URLs.
- Add the External Form (1) component from the Beta Components to your page and enter the relative URL as Form Identifier (2) in External Form Properties.
- If your form uses the integration module to execute Sapho button actions (3), add the buttons to your micro app page. Please make sure to your labels match with the calls you have set up in your external form’s Java code. Even if your buttons are hidden on the page, the labels will need to match the ones you have set in your code.
Next, you can preview your embedded form in your micro app.
Here is an example of an embedded external form that creates tasks in Asana:
You can then see the task created using the embedded form in Asana.