I'm thinking about creatures immune to necrotic damage, for example, and Chill Touch's effect (on a hit, prevents gaining hit points). RAW, I'm leaning towards no, but wanted to confirm.
Immunity to a damage type does not, generally, confer immunity beyond that damage.
In the example of Chill Touch there are three effects: damage, preventing HP gain, and clinging. A resistance to necrotic damage does not prevent either of the other two effects; the second and third are each predicated on the hit, not upon the damage.
Compare this with the wording of a spell like Banishing Smite: "if this attack reduces the target...." If a target were immune to that (force) damage the banishment would not happen, as that banishment is predicated on (the effect of) the damage.
It depends on the spell.
- If the spell's other effects are written such that they trigger off damage being suffered, then the immunity prevents the damage and the other effects obviously don't happen.
- If the spell's other effects are written such that they are not tied to the damage, then the immunity doesn't prevent them.
The case of chill touch is the latter: the other effects are in addition to, not dependent on, any actual injury caused. A target immune to necrotic damage will still be prevented from regaining HP for the turn and (if undead) have disadvantage against you, even though they don't take any damage from the spell, because those effects depend on the hit succeeding, not the damage being suffered. Put another way, the other effects are siblings of the damage effect, all of them with the hit as the causative parent — the other effects are not children of the damage.