R_
9 years agoCreator I
Avoid Creation of relatonship depending upon condition
hiii
i want to avoid creation of relationship depending upon condition that same item cannot be added in relationship
i write code to find same item but not able to avoid adding selected item in relationship
i put code on onInsertRow event of relationship grid
var rowId = gridApplet.getSelectedId();
var rid=relatedID;
alert(rid);
alert(relationshipID);
var thisItem1 = parent.thisItem;
innovator = parent.thisItem.getInnovator();
var bid=thisItem1.getProperty("id");
var imnf=innovator.newItem("bal_batch2process","get");
imnf.setProperty("related_id",rid);
imnf.setProperty("source_id",bid);
var res=imnf.apply();
var mnfCnt=res.getItemCount();
if(mnfCnt!==0)
{
alert("Mnf Process used already");
gridApplet.deleteRow(relationshipID);
var no=gridApplet.getRowsNum();
alert(no);
var gid=gridApplet.getRowId(no+1);
alert(gid);
gridApplet.deleteRow(gid);
//gridApplet.deleteSelectedItem();
// gridApplet.removeAllRows();
return this;
}