Need to clear assigned to when assignment group is changed.

rambo1
Tera Guru

Hi,

I need to remove 'closed cancel', 'closed completed' states when state is open, only when state is 'work inprogress' those two fields should be visible.

And assigned to should be mandatory in 'open' state, when assignement group is changed , assigned to should be empty.

 

Can this be achieved in one onchange cleint script?

if not how do I write script for this?

 

5 REPLIES 5

DirkRedeker
Mega Sage

Hi

What do you mean? Do you want to remove "closed cancel" and "closed complete" from the List of values in the State field?

Or are there fields on the screen, you want to hide?

 

Can you send a screenshot, showing what you want to achieve?

 

BR

Dirk

need to hide on form , I used g_form.removeoption and it is working, i want assigned to b empty whn group changes

HI

 

OK, Thank you. You can do so with a business rule, that fires as soon as the "Group" field CHANGES.

Then in the BR, you can clear out the value in the "Assigned to" field.

 

Depending on your table - in my example I just took the "task" table. See the business rule below:

 

find_real_file.png

find_real_file.png

 

Let me know, if that answered your question, and mark my answer as correct or helpful.

BR

Dirk

Vishal Khandve
Kilo Sage

Hi rambo,

1) need to remove 'closed cancel', 'closed completed' states when state is open, only when state is 'work in progress' those two fields should be visible.

Answer- you can create onchange client script- use addoption() and removeoption()

 

2) assigned to should be mandatory in 'open' state, when assignment group is changed , assigned to should be empty.

Answer-

you can create onchange client script on assignment group-

ex- 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(g_form.getValue('assignment_group' == '') || (newValue !=oldValue) )
{
//g_form.clearValue('assigned_to');
g_form.setValue('assigned_to','');
}
 

OR you can create UI policy with condition when assignment group change

UI policy action will clear the value of assigned to filed

 

Thanks,

Vishal