Test Your Work

  1. Create a new Normal Change Request
  2. Enter 3D Pinball in the Configuration Item field
  3. Are the Priority, Risk and Impact fields set correctly? Are they read-only? If not, debug and re-test
  4. Change the Configuration Item to anything except 3D Pinball
  5. Are the Priority, Risk and Impact fields read-only? Should they be?
  6. Modify the script so the Priority, Risk and Impact fields are editable if the Configuration Item is not 3D Pinball
  7. function onChange(control, oldValue, newValue, isLoading, isTemplate){
        if(isLoading || newValue === ''){
            return;
        }
    
        var affectedCI = g_form.getReference('cmdb_ci', checkCI);
    
        function checkCI(affectedCI){
            if(affectedCI.name == '3D Pinball'){
                g_form.setValue('priority', 4);
                g_form.setValue('risk', 5);
                g_form.setValue('impact', 3);
                g_form.setReadOnly('priority', true);
                g_form.setReadOnly('risk', true);
                g_form.setReadOnly('impact', true);
            }
            else{
                g_form.setReadOnly('priority', false);
                g_form.setReadOnly('risk', false);
                g_form.setReadOnly('impact', false);
            }
        }
    }
    
  8. Select Update
  9. Test and if required, debug

results matching ""

    No results matching ""