Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Problem task priority should auto populate from problem while creating a new problem task

AnkitC_77
Tera Contributor

Problem task priority should auto populate from problem while creating a new problem task.

3 REPLIES 3

sujitha16
Kilo Patron

@AnkitC_77 Please refer the below link : 

 

https://www.servicenow.com/community/developer-forum/priotiy-in-the-problem-task-should-always-inher...

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Nani18
Tera Contributor

Hello @AnkitC_77 

 

1. Navigate to System Definition > Client Scripts in ServiceNow.

2. Click on New to create a new client script.

3. Fill in the fields: - Name: Give a name to your client script. - Table: Select the Problem Task table (problem_task). - Type: Select OnLoad.

4. In the Script field, write the following script: 

function onLoad() {

//Get the problem associated with this task

var problemGr = new GlideRecord('problem');

if (problemGr.get(g_form.getValue('problem'))) {

//Set the priority of the task same as the problem

g_form.setValue('priority', problemGr.getValue('priority'));

}

}

5. Click on Submit to save the client script.

 

 

If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks

Nani

AnkitC_77
Tera Contributor

Also, the priority only needs to be auto-populated once when the new task is raised. Later both problem and problem tasks can have different priorities.