if g_form.isNewRecord set assignment group

DIVI1
Tera Expert

I need to declare value of assignment group in 'Problem' Table. 

And here is a problem, cause I just want to declare assignment group only for new records, while updating change of the assignment group should be possible.

That's how my client script look like :

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
 if(g_form.isNewRecord()){
   g_form.setValue('assignment_group', '6ae3f5b21b479850bf327bb5464bcb45');
}
}

After when I'm trying to create a Problem I've got message below assignment group field:

DIVI1_0-1695814923200.png

 

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

I would suggest you to use a Business rule. create a before insert business rule and use the below code:-

 

current.setValue('assignment_group', '6ae3f5b21b479850bf327bb5464bcb45');

 

Please mark my answer as correct based on Impact.

View solution in original post

14 REPLIES 14

Vishal Birajdar
Giga Sage

Hi @DIVI1 

 

Can you try using "Assignment Rule" instead of script.

 

Below link might help you...!!

https://docs.servicenow.com/en-US/bundle/vancouver-platform-administration/page/administer/task-tabl...

 

Create assignment rule : 

https://docs.servicenow.com/bundle/vancouver-platform-administration/page/administer/task-table/task...

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Let me check 🙂

I Can't see the option to specify condition -  if is New Record.

Hi @DIVI1 

 

Do you want to populate Assignment group automatically when you click on new button or while creating new record...??

 

If yes...then you can use set Default value for "Assignment group" by configuring dictionary (Make sure to use Dictionary override ...!!).

Default value = sys_id of group

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Look I wanted to get something like this, don't matter which assignment group user choose it's saved assigned to 'Problem Coordinators' but it should be possible to reassign for existing tickets.