On the authority of Ameer ul-Mumineen (the commander of the faithful), Abu Hafs Umar ibn al-Khattab (may Allah be pleased with him), who said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say,
Actions are but by intentions and every man shall have only that which he intended. Thus he whose migration (hijrah from Makkah to Madina) was for Allah and His Messenger, his migration was for Allah and His Messenger, and he whose migration was to achieve some worldly benefit or to take some woman in marriage, his migration was for that for which he migrated.
[Sahih Bukhari and Sahih Muslim]
COMMENTARY
Intention of a deed is required:
From the Hadith, it is clear that our deeds are based upon our intentions. In the example given, a person immigrated to Madina for the sake of marrying a woman. He will not get the reward of the other companions who migrated for the sake of Islam i.e. to establish Islam in Madina which was friendlier towards Muslims.
Compliance with Quran and Sunnah:
In addition to having the right intention, it is also required our deeds are compliant with the Quran and Sunnah. For example, if one intends to offer Salah for the pleasure of Allah (SWT) but offers it in a manner not according to the Sunnah, the salah may not be accepted.
TAKEAWAY
InshaAllah, lets assess our deeds and try to make sure we have the right intention, which is the pleasure of Allah (SWT). And our deeds are in compliance with the Quran and the Sunnah. This will InshaAllah add blessing to the outcome of whatever we are trying to achieve.