Former_Member
9 years agoIdeator I
permissions error when trying to create a relationship
Dear Community,
I am new to Aras and am trying to create a relationship from a RelationshipType with the following code:
Innovator inn = this.getInnovator();
string ItemId = this.getID();
Item item = inn.getItemByKeyedName("GivenItem", "100013-001");
string itemfather = item.getID();
if(item == null)
{
return inn.newError("No given item found.");
}
else
{
Item relItem = inn.newItem("GivenRelationship","add");
relItem.setProperty("source_id",ItemId);
relItem.setProperty("related_id",itemfather);
return relItem.apply();
}
return this;
The method runs onAfterAdd on a relationship ItemType server event.
I do not know how to solve this error which comes with the apply() method: "You have insufficient permissions to perform 'add' operation."
I am also looking for a way to retrieve the GivenItem item because we dont know its keyed name. What I want to do is to retrieve the Item of type OtherType which has a relation whith the item of type GivenItem (there will be only one each type). Is there a method which permits to get the only item of a given type?
Best regards,
Camille