The wife of Potiphar has been trying to tempt Yosef to have relations with her for a while. This is not mere physical temptation; she claims to Yosef that she is spiritually destined for him; it ends up that it is her daughter that is but not her.
When Yosef one day nearly succumbs to this temptation, Rashi quotes the well-known gemarra that the face of Yaakov Avinu appeared to Yosef at the window and Yosef immediately put a stop to any chance of this sin occuring.
What many people do not know is how the gemarra actually describes this, so here it is: The gemarra (Sotah 36b) says that not only did Yaakov’s face appear to Yosef, but Yaakov told Yosef the following: ‘your name is destined to appear on the kohen’s breast-plate as one of the tribes; do you want to have your name rubbed off because of what you are about to do?’ This is what gave Yosef the added impetus to cease what he was about to do.