Edit

Share via


Configure workspaces by using the SysAppWorkspace class

Note

Community interest groups have now moved from Yammer to Microsoft Viva Engage. To join a Viva Engage community and take part in the latest discussions, fill out the Request access to Finance and Operations Viva Engage Community form and choose the community you want to join.

Important

The finance and operations (Dynamics 365) mobile app and platform are no longer supported. The platform components supporting the mobile app will be removed in a future update. The mobile app has also been removed from app stores. Previously installed instances of the app will continue to work. For more information, see Removed or deprecated platform features.

Use the workspace class, SysAppWorkspace, to create, configure, and publish workspaces on the server. The sysAppWorkspace class provides the following categories of APIs:

  • Workspace attributes - Use these APIs to create pages, tasks, entities, lookups, and relationships to build mobile workspaces.

    • Download the sample project for Fleet Management Mobile App. This project is an .axpp file available at Dynamics365-for-Operations-mobile-FleetManagementSamples.
    • After downloading the file, open Visual Studio on your Operations development environment, select Dynamics 365 > Import Project, and browse for the downloaded project file. On the same dialog box, select Overwrite and select Create a new solution. After the import finishes, build the solution (or build the Fleet Management model).
    • To review the example, start by reviewing the FMReservationManagementWorkspace class to see all the pages and actions included in the workspace. Use Solution Explorer to find page and task classes, and all the assets included in each. Use the API reference for more details on each API.
    • You can create a mobile workspace through the designer pane, by using X++ attribute APIs, or by using a combination of both. For more details about how to import mobile app metadata from designer to AOT, see the "Use the workspace class to publish workspaces from AOT resources" section. The sample project Fleet Management Mobile App is a complete mobile app built by using X++ attribute APIs.
  • Workspace metadata classes - Use these APIs to inspect and apply server-side business logic to metadata for mobile workspaces.

For a complete list of server-side APIs, see Server-side development (workspace X++ APIs).

Create a new workspace class

To use the SysAppWorkspace class for your workspace, create a new class for the workspace that extends the SysAppWorkspace class. Use the new class to modify workspace metadata. The new class also provides hooks for life cycle management of the mobile app.

Follow these steps to create a new workspace class for your workspace.

  1. Create a new class for your workspace, and extend it from the SysAppWorkspace class.

    Screenshot of the workspace class.

  2. Add the SysAppWorkspaceAttribute attribute to the new class, and provide the AppID value for your workspace. You can find the app ID for your app on the Summary page in the mobile app designer.

    Screenshot of the app ID in the workspace summary.

    Screenshot of the AppID value in the workspace class.

  3. (Optional) If your workspace is an Application Object Tree (AOT) resource, provide the AOT resource name as the second parameter for the SysAppWorkspaceAttribute constructor.

    Screenshot of the AOT resource name in the workspace class.

Use the workspace class to publish workspaces from AOT resources

Workspaces can reside in the database or in the AOT as resources. To provide visibility into workspaces that are stored in AOT resources, you must create a workspace class and point it to the name of the AOT resource that contains the workspace. You can't edit or delete workspaces that are stored as AOT resources by using the mobile app designer. You can only export those workspaces.

Follow these steps to publish a workspace that resides in an AOT resource.

  1. When you're developing a workspace that is stored in the database, export it from the mobile app designer so that you can store it as an AOT resource. Export the workspace as an XML file.

    Screenshot of exporting a workspace.

  2. Delete the workspace from the mobile app designer. You will load it from an AOT resource later.

    Screenshot of deleting a workspace.

  3. Create a new AOT resource, and select the exported workspace for the resource.

    Screenshot of the workspace as a resource.

  4. Create a new class for your workspace. Extend this class from SysAppWorkspace. Apply the SysAppWorkspaceAttribute attribute to the class, and provide the app ID and the AOT resource name that contains the resource.

    Screenshot of the new workspace class.

  5. Build the class, and reopen the mobile app designer.

    You published the workspace. It appears in the designer, but you can't edit or delete it. The workspace is loaded from metadata.

    Screenshot of the workspace in metadata.

Update a workspace that you already published

If your workspace is part of an AOT resource, you can't edit it by using the mobile app designer. In the following example, a workspace named MyWorkspace exists in the AOT, and it has a backing class named WorkspaceInAOT.

Screenshot of the workspace in the AOT.

Screenshot of the workspace in the AOT and published.

Follow these steps to edit the workspace.

  1. Export the workspace by using the mobile app designer. The designer automatically creates new app IDs for workspaces that are stored in the AOT.

  2. Import the newly exported workspace by using the mobile app designer.

    1. (Optional) Change the name so that you can distinguish the newly added workspace from other workspaces.

    2. Copy the app ID of the newly created workspace.

      Screenshot of the new workspace in database.

      Screenshot of the new workspace details.

  3. Create a new class that extends your backing class, apply the SysAppWorkspaceAttribute attribute, and specify the new app ID.

    Screenshot of the code editor with SysAppWorkspaceAttribute.

You can now continue to work with your new workspace and the backing class. After you finish making your changes, you can merge them with the AOT-based workspace.

Delete a workspace that is an AOT resource

When you store a mobile workspace as an AOT resource, you can't delete it by using the mobile app designer. To delete a workspace that exists as an AOT resource, use the following steps.

  1. Delete the AOT resource that contains the workspace.

    Screenshot of the workspace to delete.

  2. Delete the workspace class that you created for the workspace.

    Screenshot of the workspace class to delete.

  3. Run a full model build that includes the AOT resource and the class. The following illustrations show a full build of the Application Foundation model. The Application Foundation model also contains the AOT resource and workspace class. To speed up the full build, you can clear all the selections on the Options tab.

    Screenshot of the full build menu item.

    Screenshot of the full build.

  4. When the build finishes, reopen the mobile app designer, and verify that the workspace is no longer there.