1 John 3:22
And whatsoever we ask, we receive of him, because we keep his commandments, and do those things that are pleasing in his sight.
Jesus gave us the commandment of love and in this commandment we will go through terrible situations but everything we go through is not for waste. Every negative situation we encounter God shapes it for his purpose which leads us to His destiny.
We have to do what is pleasing to God, to get what we want in our lives. If we do something good only because we will receive something from God then we have missed the whole point. What this verse says, if we have faith in God to answer our prayers then we must have a pure conscience. We do not get our prayers just because we do good things but also because we have a pure conscience.
When our heart does not condemn us and we do things with a good conscience then we know that what we are doing pleases God. We have got to develop a pure conscience in our everyday lives.
If you take 1 John 3:22 and say I will do something good so that my prayers will get answered it will not work. The problem is you are doing good with the wrong motives.
For as many as are of the works of the law are under the curse: for it is written, Cursed is every one that continueth not in all things which are written in the book of the law to do them.
When our faith is shut down it will prevent us from trusting God in our negative situation. We have do things out of love for God, and that should be our motive. God loves us no matter what we do not because we do good. This should motivate us to do good and operate in faith and do what His Word says and in that we exercise our faith.