Section 41(d) defines qualified research through four requirements. Each has its own page; this is the shape.
The work has to aim at a permitted purpose (improving a business component's function, performance, reliability, or quality), be technological in nature (resting on hard science, which for software is computer science), eliminate technical uncertainty that existed at the outset, and proceed through a process of experimentation for substantially all of the activity.
All four have to hold. Work that nails three and misses one is not qualified research, which is the most common way a strong-looking claim fails.
The four-part-test pages walk through each requirement with SaaS examples; this page is the one-paragraph version, plus what falls outside the credit entirely.