Related List

pravershi
Tera Contributor

Hello Everyone,

Can You Please Help me out with this,

 

I want to create a rule where a user can't update the Form if there are No records created/attached in a related list.

Or we can say if the related list is empty current record can't be updated.

 

Any anyone have an Idea how can I achieve this?

 

Thank you

1 ACCEPTED SOLUTION

Hi @pravershi you need to look for the field which stores parent sysid in your details table, to find records, Kindly accept or hit helpful if my response helped you.

Regards
Harish

View solution in original post

7 REPLIES 7

Harish KM
Kilo Patron
Kilo Patron

Hi @pravershi there could be multiple related list on a record which one are you looking for? Usually there will be a parent child relationship in related list table so you can check if parent is empty and you can abort the action using before update BR

Regards
Harish

Hi @Harish KM ,

Thank you so much for the suggestion.

Can You Please Guide me through the script 

pravershi_0-1710814375466.png

As I was trying the same procedure but I guess am new to scripting.

 below I attached my form SS, where we want until no item details record is added current(customer PO) can't be updated.

pravershi_1-1710814457675.png

 

 

Hi @pravershi that is a embedded list, not related list here you can write a after update BR on your table and need to glide details table to see if there is a record if no record present abort the submission

script:

  var gr = new GlideRecord('detailsTableName');
    gr.addQuery('parent', current.sys_id);//parent field will match with current record
    gr.query();
// if no record found abort action
    if (!gr.hasNext()) {
        gs.addErrorMessage("no record found");
        current.setAbortAction(true);
    }
Regards
Harish

Hi @Harish KM ,

Thanks for the help but it's still not working, I will figure it out from here.

once again Thank you for your suggestions and time.

 

regards

Pravershi