  We study the final state problem for the nonlinear Schr\"{o}dinger equation
with a critical long-range nonlinearity and a long-range linear potential.
Given a prescribed asymptotic profile which is different from the free
evolution, we construct a unique global solution scattering to the profile. In
particular, the existence of the modified wave operators is obtained for
sufficiently localized small scattering data. The class of potential includes a
repulsive long-range potential with a short-range perturbation, especially the
positive Coulomb potential in two and three space dimensions. The asymptotic
profile is constructed by combining Yafaev's type linear modifier [41]
associated with the long-range part of the potential and the nonlinear modifier
introduced by Ozawa [32]. Finally, we also show that one can replace Yafaev's
type modifier by Dollard's type modifier under a slightly stronger decay
assumption on the long-range potential. This is the first positive result on
the modified scattering for the nonlinear Schr\"{o}dinger equation in the case
when both of the nonlinear term and the linear potential are of long-range
type.
