This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - add relationship items to Item under construction ( new Item instance before save )

AshokGopale - Friday, July 20, 2012 5:28 AM:

 

Hello friends,

I want to add relationship items to the Item under construction. ( new Item instance before save )

I can add relationship items to the Item which is already saved.

I can add relationship items to new Item only after when I save it.

I used the following code ...

Please tell me where should I change the code, so that it will fulfill my need.

 

Normal 0 false false false EN-GB X-NONE X-NONE MicrosoftInternetExplorer4

//get ID of item under construction
var myItemID = top.aras.getItemProperty(document.item, 'id');
// *** get ID of item to be added in relationship tab ***//
var foractionid=top.aras.getItemProperty(document.item, 'foraction');
 
//*** get Identity item for adding into relationship tab ***//
  var qryXml = "<Item type='Identity' id='"+foractionid+"' action='get' select='id,keyed_name'/>";
  var qry = new Item();
  qry.loadAML(qryXml);
  var userItem = qry.apply();

 

 //*** get current ECR item    ***//
var ecrItem=inn.getItemById("MAN_Ashok_ECR",myItemID);
 
//add new relationship item
 var relationshipItem = inn.newItem("MAN_Ashok_ECR_InfoREL","add");
 relationshipItem.setRelatedItem(userItem);  
 ecrItem.addRelationship(relationshipItem);
 var resultItem =ecrItem.apply();
 if (resultItem.isError())
 {
  inn.AlertError(resultItem.getErrorDetail());
 }

Thanking you,

Ashok