Business rules

pnarendra12
Giga Contributor

Hi Team,

 

Please help, "How to create the business rule on the problem table  for the automatic creation of problem_task when the state is in assess and after saving the problem task has to create.

 

Thank You

2 ACCEPTED SOLUTIONS

Chaitanya ILCR
Kilo Patron

Hi @pnarendra12 ,

create an after insert update BR

ChaitanyaILCR_0-1752597023307.png

 

with script

ChaitanyaILCR_1-1752597078795.png

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

        var task = new GlideRecord('problem_task');
        task.initialize();
        task.problem = current.getValue('sys_id');
        task.short_description = 'add your task short description'; //
        task.description = 'add description';
		//add you fields and set values if needed
        task.insert();

})(current, previous);

 

 

you can also go with Flow designer too

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

Juhi Poddar
Kilo Patron

Hello @pnarendra12 

Try the solution below:

  • BR configuration:

JuhiPoddar_0-1752597115300.png

  • Script
(function executeRule(current, previous /*null when async*/ ) {
    var task = new GlideRecord('problem_task');
    task.initialize();
    task.problem_id = current.sys_id;
    task.short_description = 'Initial assessment required';
    task.description = 'Auto-generated task as problem entered Assess state.';
    task.assigned_to = current.assigned_to; // Optional: assign to same user
    task.insert();
})(current, previous);​

The above business rule will trigger when the state changes to access and create a new problem task record.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

View solution in original post

3 REPLIES 3

Chaitanya ILCR
Kilo Patron

Hi @pnarendra12 ,

create an after insert update BR

ChaitanyaILCR_0-1752597023307.png

 

with script

ChaitanyaILCR_1-1752597078795.png

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

        var task = new GlideRecord('problem_task');
        task.initialize();
        task.problem = current.getValue('sys_id');
        task.short_description = 'add your task short description'; //
        task.description = 'add description';
		//add you fields and set values if needed
        task.insert();

})(current, previous);

 

 

you can also go with Flow designer too

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Juhi Poddar
Kilo Patron

Hello @pnarendra12 

Try the solution below:

  • BR configuration:

JuhiPoddar_0-1752597115300.png

  • Script
(function executeRule(current, previous /*null when async*/ ) {
    var task = new GlideRecord('problem_task');
    task.initialize();
    task.problem_id = current.sys_id;
    task.short_description = 'Initial assessment required';
    task.description = 'Auto-generated task as problem entered Assess state.';
    task.assigned_to = current.assigned_to; // Optional: assign to same user
    task.insert();
})(current, previous);​

The above business rule will trigger when the state changes to access and create a new problem task record.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

Ankur Bawiskar
Tera Patron
Tera Patron

@pnarendra12 

what did you start with?

It's an easy requirement.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader