SN2 reactions and inversion of configuration in compounds with more than one chiral centre
Here I have a compound with 2 chiral centers. There is only inversion at Carbon with iodine undergoing $\mathrm{S_N2}$ reaction. The second carbon does not undergo $\mathrm{S_N}$ reaction. There is no change in its configuration.

Example 1



In the example below ,



[Ref : https://en.chem-station.com/reactions-2/2016/05/neighboring-group-participation.html] 

before a nucleophile attacks externally, OH of carboxylic group attacks internally via $\mathrm{S_N2}$. The 3 membred ring opens via another $\mathrm{S_N2}$ attack by hydroxide ion. The net result is retention of configuration .

Example 2

In this example , two chilral carbons are at neighboring carbons. As explained earlier , Sulphur attacks internally via $\mathrm{S_N2}$ attack. Again bromide ion attacks via another $\mathrm{S_N2}$ leading to retention of configuration ( Anchimeric assistance ).



[Ref : http://www.chem.ucla.edu/~harding/IGOC/A/anchimeric_assistance.htmll]

Example 3

This example also behaves similarly to one discissed above.


[Ref: Molecules 11(4):212-8 • April 2006   DOI: 10.3390/11040212 ]

In conclusion,


If there exists no lone pair donating group at neighboring carbon to leaving group, then $\mathrm{S_N2}$ attack takes place with inversion of configuration (Example 1).
If there exists a lone pair donating group (Example 2 and Example 3)at neighboring carbon to leaving group, then retention of configuration is seen.