Sheffield Crown Court was told how Saulias Sadlauskas, of Mutual Street, Hexthorpe was still finding it difficult to come to terms with the breakdown of his relationship with his partner of 10-years - some two years on from their break-up.
Prosecuting, Louise Gallagher, Sadlauskas and his former partner had a six-year-old son together; and she had tried to help him maintain his relationship with his child.
Ms Gallagher said she had gone so far as to give him keys to the home she shared with her son, so Sadlauskas could look after the little boy while she was at work.
In the run up to him committing the offence between April 25 and April 26, Ms Gallagher described how Sadlauskas had been abusing the custody arrangement she had set up to turn up at the house 'whenever' he liked.
Sadlauskas started harassing the complainant by sending her a series of unpleasant text messages on April 25, in which he called her names and told her to pick up the phone after persistently calling her.
Ms Gallagher told the court that the 32-year-old had become enraged due to the belief his former partner was helping a work colleague to rent a property near to her home.
The following day, the woman returned to her home after picking up her son from school.
Ms Gallagher said: "The child went upstairs and she followed him. He went into the front bedroom. She saw the defendant coming out from behind the wardrobe.
"She said initially the conversation was friendly, but after five minutes things changed.
"They continued to argue and her child started shouting for him to leave."
Ms Gallagher told the court that the argument, that took place in front of their son, escalated quickly, and Sadlauskas refused to leave.
The incident only came to an end when the woman went to a neighbour's house for help, who subsequently called the police.
Sadlauskas admitted to one count of harassment during a short hearing on Friday.
Recorder Fiona Davies made Sadlauskas the subject of a community order, ordered him to complete 15 days of a rehabilitation requirement activity and granted a restraining order which prohibits the dad-of-one from contacting his former partner for the next five years.
"I'm persuaded that because you have no previous convictions, you have pleaded guilty and I'm told you accept now that the relationship is over," said Recorder Davies.
She added: "So I shall make a community order.