How to check the value of State in BOM tab of Part?

Hi Expert, When I add components in BOM tab of a part, I need to check 'State' of  each components added using Grid Events in RelationshipType of a Part. Event is 'OnInsertRow'. When I click '+' button and pick a component, javascript needs to capture the value of 'State' (e.g: Preliminary, Released). But, a user can click '+' button one time, and select multiple components. In this case, how to capture each one of them (I mean 'state' of each component)? I used the codes below: var thisRel = tmpThisItem.getItemsByXPath("//Item[@id='" + relationshipID + "']").getItemByIndex(0); var stringthisRel = "" + thisRel; if ( stringthisRel.includes("Preliminary") ) { ..... } But, it seems to fail to get state value from each line of selected components. Instead, "stringthisRel.includes("Preliminary") " search all lines added. Would you help how to solve this issue? Thank you.