For an Integer type input type, how would I add choices?

ServiceNow Use6
Tera Guru

Hi,

Can anyone tell me how can I add choices to input type Integer?

Regards

Suman P.

1 ACCEPTED SOLUTION

Hi,

You'd access your field in dictionary, then scroll to the bottom, same as you see in your screenshots. Then...add the choices there.

Example showing when starting to make new field:

find_real_file.png

Currently, this has no choices:

find_real_file.png

Change dictionary tab for "Choice list specification to a selection, such as":

find_real_file.png

Now, add choices in dictionary, scroll down to related list:

find_real_file.png

find_real_file.png

And now it looks like this on the form:

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

6 REPLIES 6

Allen Andreas
Administrator
Administrator

Hi,

 

Please see my reply below for details on how to add choices to integer field.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

How did Brian do this?

find_real_file.png

find_real_file.png

Regards

Suman P.

Hi,

You'd access your field in dictionary, then scroll to the bottom, same as you see in your screenshots. Then...add the choices there.

Example showing when starting to make new field:

find_real_file.png

Currently, this has no choices:

find_real_file.png

Change dictionary tab for "Choice list specification to a selection, such as":

find_real_file.png

Now, add choices in dictionary, scroll down to related list:

find_real_file.png

find_real_file.png

And now it looks like this on the form:

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

By looking at the script, can you please tell me which table inputs are getting added to?

(function executeStep(inputs, outputs, stepResult, timeout) {
    //set variables for all change inputs
    var changeID = inputs.u_record.toString(); 
    var bis_svc = inputs.u_ci_business_service;
    var complex = inputs.u_complexity_of_change;
    var dificult = inputs.u_difficult_to_revert;
    var redundancy = inputs.u_redundancy_plan;
    var verify = inputs.u_verification_change;

    var justCreatedGR = new GlideRecord('change_request');
    if (justCreatedGR.get(changeID)) {//get change record to pull fields o who will take they survey.
        //create assessment
        var metricType = '2e3ab7f1d7033200532c24837e61034b'; //sys_id of the metric type you can find in change_risk_asmt table
        var assessmentDetails = new ChangeRiskAsmtSNC()._createAsmt(metricType, justCreatedGR.sys_id, justCreatedGR.assigned_to);
        var asmtInstanceSysId = assessmentDetails; //survey sys_id

        //set response in assessment questions
        var setResponse = new GlideRecord('asmt_assessment_instance_question');
        setResponse.addQuery('instance', asmtInstanceSysId);
        setResponse.query();

        while (setResponse.next()) { //set assessment answers
            if (setResponse.metric.name == 'Complexity of change') {
                setResponse.value = complex;
            } else if (setResponse.metric.name == 'Difficult to revert') {
                setResponse.value = dificult;
            } else if (setResponse.metric.name == 'Verification of change') {
                setResponse.value = verify;
            } else if (setResponse.metric.name == 'Affect critical CI or Business Service') {
                setResponse.value = bis_svc;
            } else {
                setResponse.value = redundancy;
            }
            setResponse.update();
        }

        //set assessment to complete and link to task id
        var justUpdatedInst = new GlideRecord('asmt_assessment_instance');
        if (justUpdatedInst.get(asmtInstanceSysId)) {
            justUpdatedInst.state = "complete";
            justUpdatedInst.task_id = changeID;
            justUpdatedInst.update();
        }

        //calculate assessment result and update change record with calculated risk 
        var calculatedRisk = new global.RiskCalculator(justCreatedGR).evaluateRiskImpact();
        if (calculatedRisk.riskEvaluation.risk.value == 4 || calculatedRisk.riskEvaluation.risk.value == 3 || 
			calculatedRisk.riskEvaluation.risk.value == 2) {//Check is asessment returned one of the expected values
            stepResult.setOutputMessage("calculatedRisk.risk " + calculatedRisk.riskEvaluation.risk.value);
            justCreatedGR.risk = calculatedRisk.riskEvaluation.risk.value;
            justCreatedGR.update();	
        }
        stepResult.setSuccess();//successful test
		return;
    } else {
        stepResult.setOutputMessage("Failed to calculate risk");
		stepResult.setFailed(); // fail the step
    }
}(inputs, outputs, stepResult, timeout));