Make assigned to mandatory when state changes to Closed Complete in List view

Samiksha2
Mega Sage

Hi All,

 

I want to make assigned to mandatory when state changes to Closed Complete in List view.

I have created a client script onCellEdit. Field- state

I added the logic if State is Closed Complete and Assigned to or Assignment group is empty then it will not allow to save. 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
    var saveAndClose = true;

    var ag = g_form.getValue('assignment_group');
    var as = g_form.getValue('assigned_to');
    if (newValue == 7 && ((ag == '') || (as == '')) {
            alert("Assignment group or Assigned to should not be empty")
            saveAndClose = false;
        } else {
            saveAndClose = true;
        }
        callback(saveAndClose);
    }

 

It is not working. Please help in this.

 

Thanks,

Samiksha

1 ACCEPTED SOLUTION

Martin Saeckel
Tera Expert

Hi Samiksha,

 

just for my understanding: do you want to have Assigned To mandatory so that it will block the row update in list view, when state changes to "Closed Complete"? In this case, you could consider a data policy. This should run on your task table for the condition that "State [is] Closed Complete". The data policy action would define "Assigned To" as mandatory[=]true.

If you use the data policy as UI policy as well, you with the same step apply your requirement to the form view.

 

Or did I get your request wrong?

 

Best regards

Martin

View solution in original post

14 REPLIES 14

Martin Saeckel
Tera Expert

Hi Samiksha,

 

just for my understanding: do you want to have Assigned To mandatory so that it will block the row update in list view, when state changes to "Closed Complete"? In this case, you could consider a data policy. This should run on your task table for the condition that "State [is] Closed Complete". The data policy action would define "Assigned To" as mandatory[=]true.

If you use the data policy as UI policy as well, you with the same step apply your requirement to the form view.

 

Or did I get your request wrong?

 

Best regards

Martin

Hi @Martin Saeckel ,

I tried Data policy also. But in the List it is not working.

Samiksha2_1-1696502964558.png

 

Thanks,

Sam

Hi Sam,

 

so actually your Data Policy (created it on my instance as well) should do this, when you try to update an unassigned task in the list view:

MartinSaeckel_0-1696504875641.png

 

Doesn't that work?

 

 

Hi @Martin Saeckel ,

 

Yes, I have created business rule. While testing I didnt make that inactive. I deactivated that and its working as expected now.

 

Thank you😊,

Sam

Hi @Martin Saeckel ,

It is working. Thanks.