Assigning (or Un-assigning) a Contact’s Web Role with a Classic D365 Workflow

 

Portal web-roles drive what a portal user (contact) can see and do. If you only need a straightforward set-it-and-forget-it rule—no complex branching or API calls—a classic background workflow is still the quickest tool in the box.

1 Prerequisites

RequirementWhy it matters
System Administrator or System Customizer security roleYou need permission to create workflows and update contact/adx_webrole records.
Portal solutions installedThe workflow actions Assign Web Role / Unassign Web Role are part of Microsoft’s portal managed solution.


2 Create the Workflow Shell

  1. Settings → Processes → New

  2. Enter a name, set Category = Workflow, and choose Entity = Contact.

  3. Tick Run this workflow in the background (recommended) unless you truly need real-time behaviour.

  4. Under Options for Automatic Processes, tick the event(s) that will kick things off (e.g., Record is created).

3 Add the Assign Web Role Step

  1. Click Add StepMicrosoftDynamics…PortalsAssign Web Role.



  2. In the step’s properties pane, click Set Properties.

  3. Contact: should auto-populate with Contact (Workflow).

  4. Web Role: look up and select the portal role you want (e.g., Authenticated Users, Case Manager).

  5. Optionally, add a descriptive Name for the step, like “Grant Members role”.

4 (When Needed) Add Conditions

If you only want to assign the role when certain criteria are met:

  1. Insert a Check Condition step above your Assign Web Role action.

  2. Build the logical expression (e.g., Status Equals Approved).

  3. Nest the Assign Web Role step inside the If branch.

5 Un-assigning a Role Instead

The reverse is identical:

  1. Add Unassign Web Role from the same portals menu.

  2. Pick the Same Web Role you previously granted (the workflow engine needs to know which one to remove).

  3. Place it under its own condition or under the same branch, depending on your business logic.

6 Save, Activate, Test

  1. Save & Close the designer.

  2. Click Activate in the toolbar.

  3. Create or update a contact that meets your trigger and confirm the role is added/removed under Contact → Portal Contact sub-grid Web Role Assignments.


Quick Tips & Troubleshooting

  • Multiple Roles? A contact can hold several roles; the workflow only touches the specific role you pick.

  • Idempotency: Running an Assign Web Role step twice on the same contact/role pair is harmless—the second run is ignored.

  • Audit Trails: Enable audit on Contact and Web Role assignment entities to verify who/what assigned a role.

  • Background vs. Real-time: Real-time workflows run before the form closes, useful when role assignment must be immediate for subsequent plug-ins; otherwise stick with background for performance.

  • Moving to Power Automate: For cross-tenant or non-Dataverse triggers, consider a cloud flow instead. Use the Add a new row action targeting the adx_webrole_contact intersect table (Web Role ↔ Contact).

No comments:

Post a Comment