- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2017 01:41 PM
Hello,
I need to create business rule for direct assignment of a ticket. But I need to take the company property and to assign it to the group,
which is related to the concrete company.
For example: if the ticket comes from Company Naxex, it should be assigned to group SN_LDS. How I can write it in a script?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2017 02:23 PM
Here you go. Create a BEFORE business rule and modify the script as per your need.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', current.caller_id);
gr.query();
if(gr.next())
{
var usrComp = gr.company;
var gr1 = new GlideRecord('core_company');
gr1.addQuery('sys_id', usrComp);
gr1.query();
if(gr1.next())
{
current.assignment_group = gr1.<FIELD COLUMN NAME OF GROUP';'
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 02:33 AM
suppose we have to tables, one is table1 and another is table2. if one record is inserted in table1, the same record is inserted in table2. now I need a javascript program for, if one record is deleted in table1, the same record has to be deleted in table2.