para-Dimethylaminobenzaldehyde is the main ingredient in Ehrlich's reagent.  It acts as a strong electrophile which reacts with the electron-rich α-carbon (2-position) of indole rings to form a blue-colored adduct. It can be used to detect the presence of indole alkaloids. Not all indole alkaloids give a colored adduct as result of steric hindrance which does not allow the reaction to proceed.
Ehrlich's reagent is also used as a stain in thin layer chromatography and as a reagent to detect urobilinogen in fresh, cool urine.  If a urine sample is left to oxidize in air to form urobilin the reagent will not detect the urobilinogen. By adding few drops of reagent to 3 mL of urine in a test tube one can see a change of color, to dark pink or red. The degree of color change is proportional to the amount of urobilinogen in the urine sample.