- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 04:43 PM
Hi,
my first question - so please excuse me if I have missed anything obvious.
I would like to create a request item - with some pre-populated fields - based on when a record is added to an unrelated table.
So far I have looked at trying to do it by either events, or business rules - but not having much luck (I'm also very green with scripting).
Does anyone have some pointers of how you would implement this?
Thanks,
Cath
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 06:33 PM
Hi Cath,
You can do through Business Rule, let me explain how through scripting since you are new in scripting. This might help you.
For Example: I am here trying to create an Incident when new Record gets added in Service Request (sc_request) table, checking condition that after new record is inserted and state of the newly inserted record in Open then create incident with some populated values.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('incident');
gr.caller_id = gs.getUserID();
gr.comments = 'New Incident on addition of new Record in Service Request Table';
gr.short_description = 'New Incident on addition of new Record in Service Request Table';
gr.category = "inquiry";
gr.incident_state = IncidentState.NEW;
gr.contact_type = "email";
gr.insert();
})(current, previous);
Result:
Hope this will help you to understand how to achieve, just replace the table name on which when you insert new record incident should be created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2017 06:54 PM
It Should work, i have just test on creating new incident and it worked, i will update you soon after testing the same on ritm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2017 06:59 PM