The ordinary conditions for obtaining a partial indulgence are:
22. §1. In order to be capable to gain indulgences for oneself, a person must be baptized, not excommunicated, in the state of grace at least at the end of the prescribed works, and a subject of the party granting the indulgence.
§2. However, in order that a capable subject actually gain the indulgence, he must have at least a general intention to gain them and must perform the prescribed works at the appointed time and in the proper manner according to the tenor of the grant (Enchiridium Indulgentiarum).
3. To gain indulgences, whether plenary or partial, it is necessary that the faithful be in the state of grace at least at the time the indulgenced work is completed. (The Gift of the Indulgence, Apostolic Penitentiary, January 29, 2000).