Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Script to capture priority input from record producer and show in incident table

FaizDev101
Tera Expert

Screenshot (99).png

 

 

3 ACCEPTED SOLUTIONS

@FaizDev101 try this

 

if(producer.priority == '1 - Critical'){//priority variable choices  1 - Critical "value"

current.impact =1;

current.urgency = 1;

}else if(producer.priority == '2 - High'){/priority variable choices  2 - High "value"

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == '3 - Moderate'){/priority variable choices  3 - Moderate "value"

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == '4 - Low'){/priority variable choices  4 - Low "value"

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == '5 - Planning'){/priority variable choices  5 - Planning "value"

current.impact = 3;

current.urgency = 3;

}

 

check one thing in priority variable choices  "value" should be given above in "if" and "else if"

BharathChintala_0-1676405605545.png

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

FaizDev101
Tera Expert

I used this code and it is working Thank you so much.

if(producer.priority == 1){

current.impact = 1;

current.urgency = 1;

}else if(producer.priority == 2){

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == 3){

current.impact = 1;

current.urgency = 3;

}else if(producer.priority == 2){

current.impact = 2;

current.urgency = 1;

}else if(producer.priority == 3){

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == 4){

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == 3){

current.impact = 3;

current.urgency = 1;

}else if(producer.priority == 4){

current.impact = 3;

current.urgency = 2;

}else if(producer.priority == 5){

current.impact = 3;

current.urgency = 3;

}

View solution in original post

@FaizDev101  you don't need to each number that many times each priority number once is enough

Replace this

if(producer.priority == 1){

current.impact = 1;

current.urgency = 1;

}else if(producer.priority == 2){

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == 3){

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == 4){

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == 5){

current.impact = 3;

current.urgency = 3;

}

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

7 REPLIES 7

@FaizDev101 try this

 

if(producer.priority == '1 - Critical'){//priority variable choices  1 - Critical "value"

current.impact =1;

current.urgency = 1;

}else if(producer.priority == '2 - High'){/priority variable choices  2 - High "value"

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == '3 - Moderate'){/priority variable choices  3 - Moderate "value"

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == '4 - Low'){/priority variable choices  4 - Low "value"

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == '5 - Planning'){/priority variable choices  5 - Planning "value"

current.impact = 3;

current.urgency = 3;

}

 

check one thing in priority variable choices  "value" should be given above in "if" and "else if"

BharathChintala_0-1676405605545.png

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

FaizDev101
Tera Expert

I used this code and it is working Thank you so much.

if(producer.priority == 1){

current.impact = 1;

current.urgency = 1;

}else if(producer.priority == 2){

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == 3){

current.impact = 1;

current.urgency = 3;

}else if(producer.priority == 2){

current.impact = 2;

current.urgency = 1;

}else if(producer.priority == 3){

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == 4){

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == 3){

current.impact = 3;

current.urgency = 1;

}else if(producer.priority == 4){

current.impact = 3;

current.urgency = 2;

}else if(producer.priority == 5){

current.impact = 3;

current.urgency = 3;

}

@FaizDev101  you don't need to each number that many times each priority number once is enough

Replace this

if(producer.priority == 1){

current.impact = 1;

current.urgency = 1;

}else if(producer.priority == 2){

current.impact = 1;

current.urgency = 2;

}else if(producer.priority == 3){

current.impact = 2;

current.urgency = 2;

}else if(producer.priority == 4){

current.impact = 2;

current.urgency = 3;

}else if(producer.priority == 5){

current.impact = 3;

current.urgency = 3;

}

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala