Problem

Anantha27
Mega Guru

When creating a problem ticket if the urgency and impact are high, I need to generate automatic ptask with some fields to auto populate and then the ticket should be created 

7 REPLIES 7

AndersBGS
Tera Patron
Tera Patron

Hi @Anantha27 ,

 

I would recommend you to utilize flow designer, as here you can build the logic without scripting. 

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Community Alums
Not applicable

Hi @Anantha27 ,

Create a Before BR on Problem table and add Filter condition is - Urgency - 1- High and Impact - 1 - High and add below code 

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

    // Add your code here
    var pTaskGR = new GlideRecord('problem_task');
    pTaskGR.initialize();
    pTaskGR.description = current.description;
    pTaskGR.problem = current.current.sys_id;
    pTaskGR.urgency = current.urgency;
    pTaskGR.impact = current.impact;
    pTaskGR.short_description = current.short_description;
    pTaskGR.insert();


})(current, previous);

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

The best use will be an After BR not before

If there’s an error in the record creation process, it may prevent the original insert or update from completing, leading to potential data loss or inconsistency.