Cocamidopropyl betaine is a very mild and versatile compound. As a surfactant, it gently washes skin and hair and creates a luxurious foam. It's also a good thickener and emulsifier, helping products to keep things together and is commonly considered a hair and skin conditioner too.
Derived from the fatty acids of coconut oil, cocamidopropyl betaine is a good palm-free alternative to lauryl betaine. Things being never easy, one can’t replace the other automatically though. Not made from the same fatty acids, the two compounds don’t behave the same with other ingredients and therefore, replacing lauryl betaine with cocamidopropyl betaine can be tricky as it can change the appearance, shelf life, or efficiency of products that have an already established formula, meaning it’s harder to keep the product (and the people who use it) happy. The good news is that it can definitely be used when creating new products from scratch.