It depends on how you perform your duty. There should be no self-interest or expectation, for the fruit of action, then no karma can affect you. If you experience any joy or pain, the fault lies in sincereity of dedication. It is not as simple as saying, “I dedicate this to you, Lord”. There should be total selfless surrender of a purified mind, ego, senses and intellect.