is this normal and if not what should I do

so me and my boyfriend were getting it on and we were about to have sex but as soon as he put the condom on he lost his erection what should I do or is there anything I can do ....this has happen twice and then he said its embarrassing because it's hard one minute then the next it soft the next any suggestions edited part I have tried to gave him a handjob but it doesnt work