ransok - Thursday, September 18, 2014 6:34 AM:
Hi ,
I need to delete an item's relationship items from a Dropdown's OnChange event. I tried two ways. Neither worked.
Dropdown-OnChange:
var thisItem = document.thisItem;
var deleteRels = inn.newItem("Mappings","get");
deleteRels.setAttribute("where","[Mappings].source_id = '"+thisItem.getID()+"' ");
deleteRels = deleteRels.apply();
Facing an error with this code : Event handler failed with message: TypeError: id is null
I tried in another way:
var getRels = inn.newItem("AM_SWLIC_MachineMappingsRels","delete");
getRels.setAttribute("where","[AM_SWLIC_MachineMappingsRels].source_id = '"+thisItem.getID()+"' ");
getRels = getRels.apply();
if(getRels.getItemCount()>0)
{
for(var c=0;c<getRels.getItemCount();c++)
{
var item_ = getRels.getItemByIndex(c);
item_.setAttribute("action","delete");
alert("deleted");
}
thisItem= thisItem.apply();
}
I am not facing any error with this code. But deleting is not happening. I tried item.setAction("delete");, still its not happening. How to make this happen?
Thank you.