Mindy Kaling revealed at Hulu's TCA Party on Sunday that her ex, B.J. Novak, had a hand in make her on-screen love connection with Chris Messina happen.
When it came time to the cast the role of Danny Castellano on The Mindy Project, the Kaling, 36, turned to her former boyfriend and Office costar for guidance.
"It's like he has such good taste, and he knows me so well," Kaling tells PEOPLE of her Novak, 36.
Novak, who was the producer of The Mindy Project pilot and also once played Kaling's on-screen boyfriend on The Office, had a "good" feeling after Messina left the casting session, which worked in the show's favor since Kaling wasn't initially sold on Messina, 40.
"We're such different kinds of people," Kaling reveals of her Mindy Project boyfriend. "Our energies were so different, it might be enjoyable to watch, but I didn't know going into it."
"It was just luck," she adds. Well, luck and an unorthodox assist from a lifelong friend she just happened to date not so long ago.
Reporting by SCOTT HUVER
RELATED VIDEO: Mindy Kaling Stuns in Crop Top and High-low Skirt at 'Inside Out' Premiere
The Mindy Project moves to Hulu on Sept. 15.