Загрузка...

Run Page Scripts with Parameters | Day 30 of 30 Days of AL - FINALE! 🎉

Day 30 - FINALE! Run saved page script recordings with parameters to make your tests dynamic and reusable!
What We're Doing:
Taking our Day 29 recordings and running them with different data using parameters - no need to re-record for each test case!
Load a Saved Recording:
1. Open Page Scripting

Settings → Page Scripting

2. Load Recording

Click "Open" button
Select your saved .pagescripting file
Recording loads into the pane

3. Run the Script

Click "Play" button
Watch it replay automatically
See real-time success/failure status

Using Parameters:
Parameters let you run the same recording with different values:
Example: Create Customer with Parameters
Instead of hardcoding:

Customer Name: "Contoso Ltd"
Email: "info@contoso.com"

Use parameters:

Customer Name: {CustomerName}
Email: {CustomerEmail}

Setting Parameter Values:
When you play the script:

Script prompts for parameter values
Enter new values for this run
Script executes with those values

Real-World Example:
Original Recording:
Create sales order for Customer "C00001" with Item "1000" quantity 10
Parameterized Version:

Customer: {CustNo}
Item: {ItemNo}
Quantity: {Qty}

Run 1: CustNo=C00001, ItemNo=1000, Qty=10
Run 2: CustNo=C00002, ItemNo=2000, Qty=25
Run 3: CustNo=C00003, ItemNo=1500, Qty=5
Benefits:
✅ One recording, infinite test cases
✅ Test with different data sets
✅ Reduce maintenance (update once, test many)
✅ Share reusable scripts with team
Best Practices:
1. Plan for Parameters
When recording, think about what should be variable:

Customer numbers
Item codes
Dates
Amounts

2. Name Parameters Clearly

✅ {CustomerNo}, {PostingDate}
❌ {param1}, {x}

3. Document Your Scripts
Add comments explaining:

What the script tests
Required parameters
Expected results

4. Version Control
Save recordings with version numbers:

CreateSalesOrder_v1.pagescripting
Update as processes change

Use Cases:
Scenario 1: Order Processing

Record: Create → Post → Print Sales Order
Parameters: Customer, Items, Quantities
Run: Test 10 different orders

Scenario 2: Month-End Close

Record: Period close procedures
Parameters: Period end date
Run: Test every month

Scenario 3: User Onboarding

Record: Common tasks
Parameters: User-specific data
Run: Training new employees

Pro Tips:
✅ Start simple, add parameters gradually
✅ Test parameter scripts before sharing
✅ Keep a library of common scenarios
✅ Combine with automated testing tools
✅ Run scripts after each BC update
Requirements:

PAGESCRIPTING - PLAY permission set
Saved .pagescripting file
Access to BC environment

🎉 SERIES WRAP-UP:
We covered 30 days:

Days 1-10: Payables Agent, AL basics, Table types
Days 11-16: Table types deep dive (Subsidiary, Ledger, Register, Journal, Document, Setup)
Days 17-20: Word reports without coding
Days 21-24: GitHub Copilot, MCP, AI context
Day 25: MCP in VS Code
Day 26: Copilot Studio agents
Day 27: BC MCP Server config
Day 28: Connect agents to BC MCP
Days 29-30: Page scripting for testing

Contents
0:00 (Introduction);
0:36 (How page scripting works);
4:00 (Conclusion);

What's Next:

Apply what you learned
Share with your team
Build amazing BC solutions
Keep learning!

Ref: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-page-scripting?tabs=pagescriptingpane%2Cpagescripting?WT.mc_id=DX-MVP-5005267

Thank you for joining the 30 Days of AL Programming journey! 🙏
#BusinessCentral #PageScripting #Testing #Automation #Dynamics365 #30DaysOfAL #ALProgramming #Finale

Видео Run Page Scripts with Parameters | Day 30 of 30 Days of AL - FINALE! 🎉 канала Tek Na Msangi
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять