How to get the relationship count before the parent itemtype save

Hello everyone,

I need to check that user has added  at least one  relationship before save base on some item types fields, anyone know which event I should use and how to do that? Example is just like the picture below.

  • Sample is included here,  Add below in OnBeforeAdd/Update server event

    string ValueToFetch=this.getProperty("make_buy","");

    if(value=="your condition) {


    Item RelationshipsItem=this.getRelationships("Relationshipname");

    int count=RelationshipsItem.getItemCount();

    If (count==0) {

    this.getInnovator().newError("Please add atleast one Document");



    return this;


  • Hi SunilReddy,

      I tried your code,

      But I tested that when I modify the mode, it only records the initial data

      And the relationship that I added in the modified mode he does not save


       How can this happen and what do I need to do to resolve it?

       Thanks in advance

  • Hi Mavis,

    It works for me, relationship count always gives me updated count.

    Thank you

  • Hi SunilReddy,

      Sorry for the error in my last example image


      Thank you for your help!

Reply Children
No Data