Actions Overview
Actions are the core building blocks of Advanced Portal Designer. Every request to your portal is handled by an action, which determines what content is served and how data is processed.
What is an Action?
An action defines:
- What content or data to serve
- How to process the request
- Who can access it (security)
- When authentication is required
Think of actions as the "pages" or "endpoints" of your portal.
Action Types
APD supports seven action types, each designed for different scenarios:
| Type | Code | Description | Best For |
|---|---|---|---|
| File | Html | HTML templates with dynamic tags | Web pages |
| Codeunit | Codeunit | AL codeunit execution | Complex logic |
| Data | Data | RESTful API endpoints | AJAX, APIs |
| Script | Script | AL script execution | Quick scripts |
| File Script | Html Script | HTML with embedded AL | Dynamic pages |
| Report | Report | BC report generation | Documents |
| Blob | Blob | Binary data serving | Files, images |
Action Properties
Common Properties
All actions share these properties:
| Property | Description |
|---|---|
| Web Action | Unique action code (identifier) |
| Description | Human-readable description |
| Type | The action type |
| Default | Is this the default landing page? |
| Login Action | Is this the login page? |
| Not Mapped Action | Action for external auth users without BC entity mapping |
| Cacheable | Allow browser caching |
Require Authentication
When enabled:
- User must be logged in to access the action
- Unauthenticated requests redirect to login action
- Session must have valid user ID
Security Profile
Restrict action to specific security profiles:
- Leave empty for all authenticated users
- Specify profile code to restrict access
- Multiple profiles can access if user has matching profile
Only Superusers
Ultimate restriction:
- Only portal users marked as Superuser can access
- Useful for admin-only pages
Creating an Action
Step-by-Step
- Open the Advanced Portal Designer menu page (search for it in Tell Me) and click Actions
- Click New
- Enter a Web Action code (e.g., "ORDERS")
- Enter a Description
- Select the Type
- Configure type-specific settings
- Set security options
- Save and compile (if applicable)
Naming Conventions
Recommended action naming:
| Pattern | Example | Use |
|---|---|---|
| Noun | ORDERS | List pages |
| Noun-Action | ORDER-VIEW | Detail pages |
| Verb-Noun | CREATE-ORDER | Action pages |
| API-Noun | API-CUSTOMERS | Data endpoints |
Default Action
One action should be marked as Default:
- Serves as the landing page
- Used when no action is specified in URL
- Only one action can be default
To set:
- Open the action card
- Check the Default checkbox
- Save (automatically unchecks other actions)
Login Action
One action should be marked as Login Action:
- Displayed when authentication is required
- Handles username/password submission
- Redirects to original action after successful login
To set:
- Open the action card
- Check the Login Action checkbox
- Save
Only one action can be the login action.
Not Mapped Action
When using external authentication (Auth0 or Microsoft Entra), new users are created automatically but marked as Not Mapped until linked to a BC entity.
Purpose
The Not Mapped Action handles users who:
- Have successfully authenticated via Auth0 or Microsoft Entra
- Don't yet have a BC Number (NAV Identification) assigned
- Need to complete their account setup
Setting Up
- Create an action (e.g.,
ACCOUNT-SETUP) - Check the Not Mapped Action checkbox
- Create a template to handle unmapped users
- Compile and save
Behavior
When an authenticated user with Not Mapped = Yes accesses any action:
- APD detects the Not Mapped flag
- User is redirected to the Not Mapped Action
- User cannot access other actions until mapped
Template Example
<div class="setup-required">
<h1>Account Setup Required</h1>
<p>Welcome, <?userid?>!</p>
<p>Your account is authenticated but needs to be linked to your company record.</p>
<form method="post" action="<?action(COMPLETE-SETUP)?>">
<label>Your Customer Number</label>
<input type="text" name="customerno" placeholder="From your invoice">
<button type="submit">Complete Setup</button>
</form>
</div>
Important
If external authentication is enabled but no Not Mapped Action exists, APD will show an error:
"No action defined for 'Not Mapped' users, cannot continue"
See Users Overview for complete Not Mapped flow documentation.
Action URLs
Actions are accessed via URL parameters:
Basic Format
https://yourportal.com/wsfn/?action=ACTIONCODE
With Parameters
https://yourportal.com/wsfn/?action=ORDERS&customer=10000
Default Action
https://yourportal.com/wsfn/
(Automatically uses the default action)
Action Execution Flow
When a request arrives:
1. Request received with action parameter
2. APD looks up the action
3. Security check (authentication, profiles)
4. Action type-specific execution
5. Response returned to browser
Authentication Flow
For actions requiring authentication:
1. Check if session has authenticated user
2. If not, redirect to login action
3. After login, return to original action
4. Process the action normally
Compiling Actions
Some action types require compilation:
| Action Type | Requires Compilation |
|---|---|
| File | Yes |
| Codeunit | No |
| Data | No |
| Script | Yes |
| File Script | Yes |
| Report | No |
| Blob | No |
How to Compile
- Open the action card
- Make your changes
- Click the Compile action
- Review any compilation errors
Auto-Compile
Enable in setup to compile automatically after edits.
Best Practices
Organization
- Use consistent naming conventions
- Group related actions logically
- Document action purposes
Security
- Always set appropriate security profiles
- Require authentication for sensitive data
- Use HTTPS in production
Performance
- Mark cacheable resources appropriately
- Use Data actions for AJAX when possible
- Pre-compile templates in production
Development
- Start with File actions for pages
- Use Script for prototyping
- Graduate to Codeunit for complex logic
Troubleshooting Actions
Action Not Found
- Verify action code matches URL exactly
- Check action is not marked as "Not Mapped"
- Ensure action exists in current company
Access Denied
- Check authentication requirements
- Verify security profile assignments
- Confirm user has required profile
Compilation Errors
- Review error messages carefully
- Check template syntax
- Verify table and field names exist