Answer
Start With Follow-Up Questions (Very Important in Interviews)
Before jumping into the solution, I would ask clarifying questions such as:
- Where is the user–role–organization mapping stored?
Example: Is it stored in a table like USER_ROLE_ORG with columns: USER_ID, ROLE_ID, ORG_ID, IS_ACTIVE?
- Can a third-party user belong to multiple orgs or groups?
- Is there an audit requirement or rollback requirement?
- Should the users be permanently deleted or only deactivated?
These questions help confirm assumptions and avoid designing the wrong solution.
Database Cleanup – Deactivating Third-Party Users
Assuming we have a table like:
And ROLE_ID = 3 represents third-party users.
Approach 1: Direct SQL Update
A simple solution is:
But this has issues:
- We don’t know exactly who was deactivated.
- There may be 10,000+ users, so traceability is important.
- If something goes wrong, rollback is difficult.
Better Approach: Use Audit + Stored Procedure
I would design a stored procedure with the following steps:
- Identify the users to be deactivated
- Save them in a TEMP_USER_LIST.
- Insert the same list into an AUDIT_USER_DEACTIVATION table
- USER_ID
- ROLE_ID
- ORG_ID
- DEACTIVATION_TIME
- IS_COMPLETED (0/1) ← for tracking Appian side cleanup later
- Perform SQL update
- Mark users as inactive in the main table.
This covers database-level cleanup with full traceability.
Appian-Side Cleanup — Removing Users From Third-Party Groups
After DB deactivation, we still need to remove the users from Appian Groups.
Easy approach create an MNI that loops through 10,000 users.This will create 10,000 instances → massive load → difficult to track failures.
Scalable Appian Design — Batch Processing + Recursive Execution
Batch Removal Using Sub-Process
- Create an expression rule that fetches only users with IS_COMPLETED = 0 from audit.
- Use a Process Model with:
- Batch size (e.g., 100 users at a time)
- Loop or recursive chaining until all users are processed
High-Level PM Flow:
- Node 1 – Query Audit Table
- Fetch up to 100 records (batch size).
- Node 2 – MNI Sub-Process (100 max)
- Each instance:
- Removes the user from the Third-Party Group using Smart Service
- Updates IS_COMPLETED = 1 in the audit table
- Node 3 – Timer Event
- Add 1–2 min cooldown to reduce load.
- Node 4 – Decision Node
- If any users are still IS_COMPLETED = 0,
- → Call same process again (recursive call).
This produces:
- Efficient processing
- No huge MNI bursts
- Audit tracking
- Restart capability if anything fails
- Safe and scalable for 10,000+ records
Tips for Interview:
Interviewers do not expect a perfect solution.
They check your ability to:
- ask the right clarifying questions
- understand data models
- design a safe, trackable, scalable solution
- explain your approach clearly
As long as your logic is structured and scalable, you will stand out.