Find the Key of the song by looking at the sharps and flats at the beginning of your line. For help, use this circle of fifths:
In any key, Tonic = the root chord, or ‘I’. It has a major 7th. Dominant = the fifth chord, or ‘V’. It has a minor 7th.
In D major these are:
The ‘III’ and ‘VI’ share 3 notes with the ‘I’, which makes them Tonics, too. In the Key of G major, this gives us:
You can play a G Tonic lick on all three of these chords …
The ‘V’, ‘VII’ and ‘II’ share 3 notes each, too, which makes them all Dominants:
These three are all suitable for a Dominant lick in key of G: