Hi,I have a requirement to make closecode and close notes to be mandatory when state is canceled

Vishali3
Tera Contributor

1.I have a data policy on incident table to make close code and notes mandatory when state is resolved or closed.

2.I have 2 ui policies with same order 100 

i.when state is closed or cancelled then make close code and notes read only.

ii.when state is canceled then make close code and notes are mandatory and read only ie leave alone.

 

so when i am changing the state to resolved to canceled the closecode and notes should be mandatory but its not working.Please help me with this requirement.

 

4 REPLIES 4

Bert_c1
Kilo Patron

Post details on what you have done and you will get a response.

AndersBGS
Tera Patron
Tera Patron

Hi @Vishali3 ,

 

Please share a snip of your two UI policies, then it will be much easier to help you.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thump up.

 

Best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Bert_c1
Kilo Patron

It seems 1 and 2.i conflict.

 

1. a data policy on incident table to make close code and notes mandatory when state is resolved or closed.

2.i when state is closed or cancelled then make close code and notes read only.

 

and as recommended, post the definitions you have and folks here will help.

praneeth7
Tera Guru

Hi @Vishali3 

Since you are trying to make the field Read-only without setting any values in close code and notes when you already made the fields as mandatory, it won't work. before setting the fields as read only you have to set some values on those fields. then it should work. 

for that you can have a onChange Client script, that will do the work,

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
//6,7 and 8 are back-end values of Resolved,Closed and Cancelled
    if (newValue == 6 || newValue == 7) { 
        g_form.setMandatory('close_code'true);
    } else if (newValue == 8) {
        g_form.setMandatory('close_code'true);
        g_form.setValue('close_code''Solution provided');
        g_form.setMandatory('close_notes'true);
        g_form.setValue('close_notes''Solution provided');
        g_form.setReadOnly('close_code'true);
        g_form.setReadOnly('close_notes'true);
    }
}

If you find this useful Kindly mark my answer as Accepted Solution and Helpful,

Thank you