Setting wall layer material using VA API

I would like to get some advice on the va.SetStyleComponentMaterialIndex() function. I am currently creating a new material id with an existing material tagged to it. I then assign it to the wall layer using the va.SetStyleComponentMaterialIndex() function. The script runs but when I check the wall layer, it is blank in the material entry. When I check the wall layer style using va.GetStyleComponentMaterialIndex(), it states invalid material ID. Could you let me know how to fix this issue? @enric

image