A PowerApps Component Framework (PCF) control for validating Singapore NRIC/FIN (National Registration Identity Card) and FIN (Foreign Identification Number) numbers.
- ✅ Real-time validation of Singapore NRIC/FIN numbers
- ✅ Format validation (prefix, digits, checksum letter)
- ✅ Checksum algorithm verification
- ✅ Auto-formatting (converts to uppercase, removes invalid characters)
- ✅ Visual feedback with color-coded validation messages
- ✅ Supports all NRIC/FIN types: S, T, F, G, M prefixes
- ✅ Read-only mode support
- ✅ 9-character maximum length enforcement
Singapore NRIC/FIN numbers are unique identification numbers issued to:
- S prefix: Singapore Citizens (born before 2000)
- T prefix: Singapore Citizens (born from 2000 onwards) and Permanent Residents
- F prefix: Foreigners (issued before 2000)
- G prefix: Foreigners (issued from 2000 onwards)
- M prefix: Foreigners (issued from 2022 onwards)
Format: [Prefix][7 digits][Checksum Letter] (e.g., S1234567D)
Before you begin, ensure you have the following installed:
- Node.js (LTS version recommended)
- .NET Framework 4.6.2 Developer Pack or later
- Power Platform CLI
- A code editor (e.g., Visual Studio Code)
o Download solution o Go to your Dynamics 365 CRM environment. o Navigate to Settings > Solutions. o Click Import and select the generated zip file. o Follow the prompts to complete the import process.
SingaporeNricValidator/
├── SingaporeNricValidator/ # PCF component source
│ ├── index.ts # Main component logic
│ ├── ControlManifest.Input.xml # Component manifest
│ └── generated/ # Auto-generated type definitions
├── EcellorsSingaporeNRICSolution/ # Solution wrapper for deployment
├── package.json # NPM dependencies
├── tsconfig.json # TypeScript configuration
└── eslint.config.mjs # ESLint configuration
- Clone the Repo
git clone https://github.com/pavanmanideep/Singapore-Identity-Number-Validator-PCFControl.git
-
Build the solution
npm run build
-
Create a solution package (using Power Platform CLI)
pac solution init --publisher-name YourPublisher --publisher-prefix prefix pac solution add-reference --path ./ msbuild /t:build /restore
-
Import to Power Apps
-
Navigate to Power Apps
-
Go to Solutions
-
Import the managed solution package available for this control
-
Open any entity form
Next
Create a single line text column, let's say we create Singapore NRIC/FIN
Bind this field to control, by attaching it to a component

-
- Valid NRIC/FIN: Green message "Valid NRIC/FIN."
- Invalid Format: Red message "Please enter a valid Singapore NRIC Number"
- Empty Field: Gray message "Enter NRIC/FIN."
The control implements the official Singapore NRIC/FIN checksum algorithm:
-
Format Check: Verifies the format matches
[STFGM][7 digits][Letter] -
Checksum Calculation:
- Multiply each digit by weights: [2, 7, 6, 5, 4, 3, 2]
- Add offset based on prefix (T/G: +4, M: +3)
- Calculate remainder when divided by 11
- Compare with expected checksum letter
-
Checksum Letter Sequences:
- S/T (Citizens): J, Z, I, H, G, F, E, D, C, B, A
- F/G/M (Foreigners): X, W, U, T, R, Q, P, N, M, L, K
Try these sample valid NRIC numbers in the test harness:
- S1234567D
- T1234567J
- F1234567N
- G1234567X
If you were interested in using this control, there is a managed solution in the Repo, you can install this solution in your environment, clone this repo, built control at your convenience following
https://ecellorscrm.com/2023/02/23/run-pcf-code-components-in-browser-quick-recap/
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on the official Singapore NRIC/FIN validation algorithm
- Built with PowerApps Component Framework (PCF)
- Developed for use in Microsoft Power Apps model-driven applications
- Wikipedia page: https://en.wikipedia.org/wiki/National_Registration_Identity_Card
For issues, questions, or contributions, please use the GitHub issue tracker.
Note: This control validates the format and checksum of NRIC/FIN numbers but does not verify if the number is actually issued by the Singapore government. Always verify identity documents through official channels. Once the managed solution is imported to the target Power Platform Environment, you may loose the capability to delete the control, so please use at caution.
