Automate Post on TASK

tmccasland
Tera Contributor

Is there a way to select tasks assigned to me and post a question to the requestor?

1 ACCEPTED SOLUTION

Then you can use the template bar for the same.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



View solution in original post

5 REPLIES 5

Amit Gujarathi
Giga Sage
Giga Sage

HI @tmccasland ,
I trust you are doing great.
You can create a BR for the same

Script :

(function executeRule(current, previous /*null when async*/) {
    // Check if the task is assigned to the current user
    if (current.assigned_to == gs.getUserID()) {
        // Get the requestor's user record
        var user = new GlideRecord('sys_user');
        if (user.get(current.requested_by)) {
            // Post a question to the requestor
            var workNote = "Hello " + user.name + ", I have a question regarding this task. Can you please provide more details?";
            current.work_notes = workNote;
            current.update();
        }
    }
})(current, previous);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



HI Amit, thanks for the info, but I am limited to using the ServiceNow UI and don't believe I have access to create scripts

Then you can use the template bar for the same.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



tmccasland
Tera Contributor

Thanks Amit, it seems templates are disabled or I don't have permission.  When I click on submit, it just rehreshed the screen and did not produce the form for building the template