- Added new FAQ sections to the TV Services and Public Internet Plans pages, improving user assistance and engagement. - Updated the Onsite Support page to utilize a dedicated content component for better organization and maintainability. - Included device compatibility information in the SIM Plans content, enhancing user clarity on service offerings. - Improved the structure and functionality of FAQ items across various service pages for a more interactive user experience.
6.6 KiB
6.6 KiB
SIM Inventory CSV Import - Screen Flow Setup
This guide provides the Apex class and Screen Flow configuration to enable employees to import Physical SIM data via CSV file upload.
Simplified for Physical SIM imports only - no header row expected.
Overview
The solution consists of:
- Apex Invocable Class - Parses CSV and creates SIM_Inventory__c records
- Screen Flow - Simple UI with just file upload and results display
Step 1: Deploy the Apex Classes
Copy the Apex classes from:
docs/integrations/salesforce/apex/SIMInventoryImporter.clsdocs/integrations/salesforce/apex/SIMInventoryImporterTest.cls
Deploy Steps:
- Go to Setup → Apex Classes → New
- Paste the content of
SIMInventoryImporter.cls→ Save - Create another class, paste
SIMInventoryImporterTest.cls→ Save - Run tests to verify (Setup → Apex Test Execution)
Step 2: Create the Screen Flow
Flow Configuration
- Go to Setup → Flows → New Flow
- Select Screen Flow
- Click Create
Flow Elements
Element 1: Screen - File Upload
Screen Properties:
- Label:
Upload Physical SIM CSV - API Name:
Upload_SIM_CSV
Components on Screen:
-
Display Text (Header)
- API Name:
Header_Text - Content:
# Import Physical SIM Inventory Upload a CSV file containing Physical SIM data. **Expected format (no header row):** `Row,Phone_Number,PT_Number,OEM_ID,Batch_Date,,,,,` **Example:** `1,02000002470001,PT0220024700010,PASI,20251229,,,,` - API Name:
-
File Upload
- API Name:
CSV_File_Upload - Label:
Select CSV File - Allow Multiple Files:
No - Accept:
.csv - Required:
Yes
- API Name:
Element 2: Action - Call Apex Importer
Action Properties:
- Category:
Apex - Action:
Import SIM Inventory from CSV
Input Values:
contentDocumentId→{!CSV_File_Upload}(the file upload component returns the ContentDocumentId)
Store Output:
- Create variables to store the output:
ImportResult_Success(Boolean)ImportResult_RecordsCreated(Number)ImportResult_RecordsFailed(Number)ImportResult_ErrorMessages(Text)ImportResult_SummaryMessage(Text)
Element 3: Screen - Results
Screen Properties:
- Label:
Import Results - API Name:
Import_Results
Components:
-
Display Text (Success Message)
- API Name:
Success_Message - Visibility: Show when
{!ImportResult_Success} Equals true - Content:
✅ **Import Successful** **Records Created:** {!ImportResult_RecordsCreated} {!ImportResult_SummaryMessage} - API Name:
-
Display Text (Error Details)
- API Name:
Error_Details - Visibility: Show when
{!ImportResult_RecordsFailed} Greater than 0 - Content:
⚠️ **Some records had issues:** {!ImportResult_ErrorMessages} - API Name:
-
Display Text (Failure Message)
- API Name:
Failure_Message - Visibility: Show when
{!ImportResult_Success} Equals false - Content:
❌ **Import Failed** {!ImportResult_ErrorMessages} - API Name:
Step 3: Flow Diagram (Simplified)
┌─────────────────────────┐
│ Start │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Screen: Upload CSV │
│ - File Upload only │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Action: Import SIM │
│ Inventory from CSV │
│ (Apex Invocable) │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Screen: Import Results │
│ - Success/Fail Message │
│ - Records Created │
│ - Error Details │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ End │
└─────────────────────────┘
Step 4: Add Flow to Lightning App
- Go to Setup → App Manager
- Edit your app (e.g., "Sales" or custom app)
- Add the Flow to utility items or create a Tab
- Alternatively, embed in a Lightning Page:
- Edit any Lightning Record Page
- Add "Flow" component
- Select your "Import SIM Inventory" flow
Alternative: Quick Action Button
Create a Quick Action to launch the flow from the SIM Inventory list view:
- Setup → Object Manager → SIM Inventory → Buttons, Links, and Actions
- Click New Action
- Action Type:
Flow - Flow: Select your import flow
- Label:
Import SIMs from CSV - Add to Page Layout
CSV File Format Reference
Your CSV files should follow this format:
| Column | Field | Example | Required |
|---|---|---|---|
| 1 | Row Number | 1 | No (ignored) |
| 2 | Phone Number | 02000002470001 | Yes |
| 3 | PT Number | PT0220024700010 | No |
| 4 | OEM ID | PASI | No |
| 5 | Batch Date | 20251229 | No |
| 6-9 | Empty | No |
Example CSV:
1,02000002470001,PT0220024700010,PASI,20251229,,,,
2,02000002470002,PT0220024700020,PASI,20251229,,,,
3,02000002470003,PT0220024700030,PASI,20251229,,,,
Troubleshooting
Common Issues
-
"Not enough columns" error
- Ensure CSV has at least 5 columns (even if some are empty)
- Check for proper comma separators
-
"Phone number already exists" error
- The phone number is already in SIM_Inventory__c
- Check existing records before importing
-
File upload not working
- Ensure file is .csv format
- Check file size (Salesforce limit: 25MB for files)
-
Permission errors
- User needs Create permission on SIM_Inventory__c
- User needs access to the Flow
Security Considerations
- The Apex class uses
with sharingto respect record-level security - Only users with appropriate permissions can run the Flow
- Consider adding a Permission Set for SIM Inventory management
Last Updated: January 2025