Generally speaking, no. Jamf itself is just running a policy to remove Application A and install Application B. Jamf does not perform posture checking, it has similar functions, but they cannot really be leveraged in this manner.
I would suggest moving Sophos to monitor only and installing Defender before removing Sophos assuming you must do this in one sweep rather than separating the two events. This way if something goes wrong, you can flip a switch and put Sophos into high enforcement again and you never lose visibility on the device. Jamf Helper could put a full screen notification up until the workflow has completed that most users won't know how to dismiss.
Workflow:
- Run Policy A that calls the script for Jamf Helper.
- Device gets a full screen notification.
- Script calls Policy C from CLI to install Defender.
- if statement to ensure Defender was installed.
- If defender failed to install, exit 1 and fail the policy.
- If defender succussed its install, continue.
- Script calls Policy B from CLI to uninstall Sophos.
- if statement to check to ensure Sophos was removed.
- If Sophos failed to uninstall, exit 2 and fail the policy.
- If Sophos uninstalled successfully, continue.
- Script checks for success on the previous two steps.
- Exit 0 and reboots if successful (or close Jamf Helper dialog)
- Exit 3 Notify user to call support if something went wrong. (should something else stupid happen that you are looking for)
- Policy exits and reports status.