Credit: Joe Kohen/

Jennifer Lopez is taking over the small screen.

The 40-year-old actress - who is rumored to be appearing on an upcoming episode of Fox's Glee as the "cafeteria lady" - will guest star on an upcoming episode of CBS' How I Met Your Mother.

According to USA Today, she is set to play Anita Appleby, a no-nonsense author of self-help books that teach women how to ""train" men in relationships through the power of denial. When Robin (Cobie Smulders) tells Anita how lothario Barney (Neil Patrick Harris) acts toward women, Anita decides to "break" him.


Look for Lopez's episode to air sometime in March.

The same month, Carrie Underwood is set to appear on the show as a pharmaceutical sales rep who falls for Ted (Josh Radnor).