New field (Reassignment Reason) is visible/mandatory when assigned to is updated

ahmed-24
Tera Contributor

i want to create a new field (Reassignement reason) which is (Visibile/mandatory) when the assigned to is updated 

Icreate a UI Policy whith script; i also create a client script. But it's not working!!

Help please. 

21 REPLIES 21

Roshnee Dash
Tera Guru

Hi @ahmed-24 

 

Could you clarify the issue you're experiencing? Is the field not hiding even when you're not changing the value, or is it not appearing when you're trying to change the 'Assigned To' value?

 

Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash

Hello @Roshnee Dash @AndersBGS i have created a new field on incident table ( u_reassignment_reason   ) when assiged to changes this field appears (visible) on mandatory to put the reason for the assiged to update. so i made this script UI policy for this new field : 

  • Type: String or Choice (depending on your needs)
  • Name: u_reassignment_reason
  • Label: Reassignment Reason
  • Name: Show Reassignment Reason
  • Table: Incident
  • Type: onChange
  • Field name: assigned_to
  • UI Type: All (or Desktop if mobile not needed)

(function executeRule(gForm, gUser, gSNC) {
var originalAssignedTo = gForm.getValue('assigned_to');

gForm.setMandatory('u_reassignment_reason', false);
gForm.setDisplay('u_reassignment_reason', false);

gForm.onChange('assigned_to', function(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}

if (newValue !== oldValue) {
gForm.setDisplay('u_reassignment_reason', true);
gForm.setMandatory('u_reassignment_reason', true);
} else {
gForm.setDisplay('u_reassignment_reason', false);
gForm.setMandatory('u_reassignment_reason', false);
}
});
})(gForm, gUser, gSNC);

 

 

Hi @ahmed-24 

1.You can create a UI Policy with UI Action:-
2.In condition just mentioned Assigned to Changes
3.Under Ui Action create select the custom field with 
Mandatory as true and Display True.

4.For the field in Dictionary dont check for mandatory.

Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash

@Roshnee Dash it's not working !!