There's no way that the oil could trigger the check engine light because the oil pan has no sensors in the oil that connect to the engine computer to connect to the check engine light to trigger the check engine light.
However some vehicles especially newer vehicles usually come with a change engine oil light that can be triggered when the engine oil is dirty and needs changed.
If your vehicle doesn't have a change oil light and you haven't changed the engine oil in 3,000 miles or longer then it's usually time to change the engine oil and oil filter.
But if your check engine light is on then it's usually caused by other things such as loose fuel cap, bad ignition coils, bad spark plugs, bad spark plugs, bad ignition module, low fuel pressure, dirty or bad fuel injectors etc.
If your check engine light is on you can get the check engine light tested to see what is causing the check engine light to come on for free at Autozone or other auto parts stores.
The check engine light test will let you know what is causing the check engine light to come on so you can have someone fix the problem or you can buy the part yourself and fix the vehicle.
Sometimes you'll need to have a mechanic turn the check engine light off even after you fixed the problem.
The check engine light usually goes out on it's own after 100 miles or so but if not then you need to have it turned off by a mechanic or someone with a check engine light diagnostic tool.