incident opent by will populate Assigned To
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 06:33 AM
Hey! I need help
I want when saving a new incident (new), if the fault is not marked as a call log that would be false (this is a checkbox I created) then to automatically populate the Assign to with whoever created the fault. I tried everything and it doesn't work now I tried client script-onSumbit that its not work!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 08:26 AM
Hello @yardenKrispel ,
The script seems fine initially, using the `setValue` method to set the "assigned_to" field to the current user's ID. Yet, there's a minor syntax issue: `gs.getUserID` is a function and requires parentheses for a correct call. The corrected script is as follows:
(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessage("Business Rule triggered on incident insert.");
gs.log("Business Rule triggered on incident insert. Current Record ID: " + current.sys_id);
// Set "assigned_to" to the current user's user ID
current.setValue("assigned_to", gs.getUserID());
})(current, previous);
Let me know your views on this and Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 08:43 AM
no work...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 08:50 AM
that is user example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 08:21 AM
Hello @yardenKrispel
Just an query....!!!
Is this a business requirement....?? OR you are doing this practice....??
Because Assigned to is someone who will work on this incident (generally Ops team member) to resolve that issue and Opened by is someone who logged that incident generally it will be end user...
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 08:42 AM
how do I do it?