- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 04:23 AM
Hi All,
Please advise me on how to configure the option/button for creating New Child Incident from being on the Parent incident form. Once the Create New child is clicked, it should link to the existing parent on which we are currently in?
Can someone help me with the steps I need to follow in order to achieve this? If anyone has done this, please share the script pattern for the same.
Awaiting your response.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 02:02 AM
1) If your requirement is to achieve it specifically via a UI button then have a UI Action with below code.
var inc = new GlideRecord("incident");
inc.initialize();
inc.short_description = 'Child Incident';
inc.parent = current.sys_id; //Relating the current incident as the parent
var sysID = inc.insert();
gs.addInfoMessage("Child Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);
2) You can also do this via the related list as Mrudula suggested. Personalize/Configure the list control and ensure the 'Omit new button' is unchecked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 04:54 AM
Cretae a new UI Action on 'incident' table with below script.
var inc = new GlideRecord("incident");
inc.initialize();
inc.short_description = 'Child Incident';
inc.parent = current.sys_id; //Relating the current incident as the parent
var sysID = inc.insert();
gs.addInfoMessage("Child Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2016 08:32 PM
Hi Guhan,
Your code works for about 70 % but only thing which is not working here is, it creates a Child Incident and the number is displayed, but it does not get linked to the parent incident and get registered in the db. See below screen shot, which shows the behavior when Clicked on the UI action "Create Child Incident". After this I will have to go back to the parent. But parent remains as it is. Please check and let me know where I am going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 02:02 AM
1) If your requirement is to achieve it specifically via a UI button then have a UI Action with below code.
var inc = new GlideRecord("incident");
inc.initialize();
inc.short_description = 'Child Incident';
inc.parent = current.sys_id; //Relating the current incident as the parent
var sysID = inc.insert();
gs.addInfoMessage("Child Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);
2) You can also do this via the related list as Mrudula suggested. Personalize/Configure the list control and ensure the 'Omit new button' is unchecked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2016 11:38 PM
Thank you Guhan for your help and support. After Configuring the List control with Omit New Button unchecked, it worked
Thanks a TON!!