Patients with advanced or metastatic NSCLC who have EGFR mutations are the primary candidates for erlotinib. Before starting treatment, doctors typically conduct tests to check for these mutations. For pancreatic cancer, it is prescribed for patients with locally advanced, unresectable, or metastatic disease.