God meant it for goodness
In Genesis 50:20, this signifies to turn their temptations into good, for what God intends, He performs. (Arcana Coelestia 6572)
Arcana Coelestia # 6572
6572. 'God thought [to turn] it into good' means that the Divine turns it into good. This is clear from the meaning of 'thinking into good' as intending, dealt with immediately above in 6571; but because the expression is used with reference to God, actually turning something into good is meant. For what God intends, that He does.