You want to check the grouped property of the artLayer.
if( activeDocument.activeLayer.grouped == false ) activeDocument.activeLayer.grouped = true;
Note for some reason setting the property acts as a toggle so you need the test for false before setting to true.
Thank you so very much. I was having a hard time going by the documentation. It is all copasetic now!