Robert Pattinson did appear in Harry Potter and the Goblet of Fire (2005) as Cedric Diggory. (He later played Edward Cullen in Twilight.)
During the Triwizard Tournament, Cedric is romantically interested in Cho Chang (Ravenclaw Seeker). They attend the Yule Ball together, and their flirtation is a subplot—until Cedric's tragic death in the graveyard.
Some assume Pattinson wasn't in Harry Potter because his breakout was Twilight. But Cedric Diggory was his first major film role.