simply repeat the process

Once you differentiate with respect to y and set the result equal to Q

Integrate and add a function of z only instead of the integration constant.

Now differentiate wrt to and set equal to R

As a simple eg F = x i + y j + z k

du/dx = x

u = x^2/2 +C(y,z)

du/dy = dC/dy = y

C(y,z) = y^2/2 + h(z)

u = x^2/2 +y^2/2 +h(z)

du/dz = h ' (z) = z

h(z) = z^2/2

u = x^2/2 +y^2/2 +z^2/2