When I click NEW on my List Control to create new child tickets, it does not capture the Parent Case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2023 10:35 AM
Hi
I have 3 tables (Table 1, Table 2, and Table 3).
Table 1 uses a List Control that directs to Table 2 to create new records (they should be child records from table 1).
When I click NEW from table 1, it opens a form (form from table 2) to enter the information, and the information is actually created and store in Table 2. I have a business rule in table 2 that says "If field UUU says OOO create a new record in Table 3 which works, but Table 3 record does not have the Parent Case #.
I have a similar business rule that works, but that one uses a M2M table to collect the Parent Case.
Any suggestions?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2023 11:13 AM
Post the code that creates the record in Table 3. Is there a field Table 2 that has the "Parent Case #". Or add 'gs.info();' lines that output related values for what you are trying to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2023 11:13 AM
Hi @AngelP83 ,
In the same Business Rule add a logic table 2 reference record and using that you can Glide Record and Query the table1 and add it in table 3 as a parent case.
Let me know if you need help with the script.
Please mark my answer as helpful and accept it as a solution, if it helps you !!
Thanks & Regards,
Suma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2023 07:14 PM
It would be amazing if you could help me build the script, my scripting experience is low.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2023 08:17 PM
This is a script that I been working on, it creates the new record on the desired
(function executeRule(current, previous /*null when async*/ ) {
var res = {};
var obtask = new GlideRecord("sn_observable");
obtask.addEncodedQuery("observable=" + current.sys_id);
obtask.orderBy("sys_created_on");
obtask.setLimit(1);
obtask.query();
if (obtask.next()) {
res.value = obtask.observable.value;
res.typeName = obtask.observable.type.name;
res.obSightingCount = obtask.observable.sighting_count;
res.obNotes = obtask.observable.notes;
res.createdBy = obtask.getValue("sys_created_by");
res.taskId = obtask.sys_id;
res.assignedToName = obtask.assigned_to.user_name;
res.sdesc = obtask.short_description;
res.source = obtask.task.u_source.getDisplayValue();
}
var sit = new GlideRecord("sn_task");
var desc = "";
desc += "Incident Source System: " + res.source + "\n";
desc += "Value: " + res.value + "\n";
desc += "Type: " + res.typeName + "\n";
desc += "Incident Count: " + res.obSightingCount + "\n";
desc += "Notes: " + res.obNotes;
sit.initialize();
sit.setValue("parent", res.taskId);
sit.setValue("priority", 3);
sit.setValue("assignment_group", "056ef4e01b9d34501123123123131321");
sit.setValue("assigned_to", "13123213213132321313");
sit.setValue("short_description", "False Positive Request");
sit.setValue("description", desc);
if (res.createdBy != "admin" && res.createdBy != "system") {
sit.setValue("affected_user", getUser(res.createdBy));
} else {
sit.setValue("affected_user", getUser(res.assignedToName));
}
sit.insert();
table, but it does not transfer any other information such as parent ticket, or description etc...