How to compare old value and new value on Create/Edit Record

How to compare old value and new value on Create/Edit Record

I have a custom module[Project], there is a Lookup Field[Contacts].
I want to change more than 10 Fields from [Contacts] Fields to custom module[Project] Fields when the Contact ID changed.
I try to use Automation Workflow Rules Function whenever a [Project] is created or is edited, the variable "input.<Field API Name>" is not working, the error message is " Variable 'Contact_Name' is not defined"