I am sharing the code here, it helped us in solving lots of complex business requirements.
function GetAttr (AttribName)
{
var ps = TheApplication().NewPropertySet();
var ps2 = TheApplication().NewPropertySet();
GetCPInstance(ps);
ps2 = ps.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(0);
var count = ps2.GetChildCount();
for(var i = 0; i< count; i++)
{
var curr_node = ps2.GetChild(i);
var name = curr_node.GetProperty("Name");
if (name == AttribName)
{ var value = curr_node.GetProperty("Value");
ps=null;
ps2=null;
curr_node = null;
return(value);
}
}
}
Note: This code will return the attribute value of root product only, for other child products code needs to be modified accordingly.