Pass dynamic Items through workflow notification system

In Sitefinity CMS, you are able to pass an item created with a dynamic module through the workflow notification system programmatically. This article contains an example of how to chive this.

PREREQUISITES:

You must be logged in as a user who can create and modify dynamic items, but not as admin.

You must have a workflow defined on your site with enabled notifications.
For more information, see Define workflows.

Perform the following:

  1. Create a dynamic module, following procedure Overview: Dynamic modules and the Module Builder.
  2. Name the module Test and add the following fields:
    • Title
    • Name
    • TelephoneNumber
  3. Create a sample form (web user control) with the same fields as in the dynamic module.
  4. Perform the following:
    1. Open your project in Visual Studio.
    2. In the context menu of SitefinityWebApp, click Add » New Item...
    3. Under Visual C#, click Web » Web User Control.
    4. In Name, enter TestForm.ascx
    5. Inside the TestForm.ascx, place the markup of the sample form. 

      EXAMPLE: For more information about the contents of the file, see TestForm.ascx in Sitefinity documentation-samples on GitHub.

    6. Inside the TestForm.ascx.cs, place the code-behind of the sample form.

      EXAMPLE: For more information about the contents of the file, see TestForm.ascx.cs in Sitefinity documentation-samples on GitHub.

    Register the form as user widget in Sitefinity CMS toolbox, using procedure Register a new widget in Sitefinity CMS toolbox.
  5. Build your solution.
  6. In Sitefinity CMS backend, create a page and drop the TestForm widget on it.
  7. Login with account different from the admin, open the page with the form, and fill it out.
    The form’s status is changed to Awaiting Approval and the workflow sends an email to the user who is subscribed for notifications.

Was this article helpful?