If an employee or office holder receives earnings for a year when they are (or were) not resident, or not ordinarily resident, or not domiciled in the United Kingdom, the amount received may not be, or may only partly be, chargeable to tax. Detailed guidance is at EIM40001 onwards. In general you will find that, in cases involving non-UK residence or domicile:
Remember that it is the employee’s residence and domicile status in the year that the earnings are for that determines whether (or to what extent) the earnings are chargeable to tax (see EIM42201).