Create Defect UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2023 01:29 AM
I want to create a 'Create Defect' (rm_defect) UI Action in rm_story form and associate it to that story
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2023 02:27 AM - edited ‎10-01-2023 02:43 AM
Hi @Balakrishna_ABK ,
Create new ui action button on table rm_story and write script in server side script of ui action
Name: -Create Defect
Table-rm_story
Action Name-create_defect
Form button:Check
Onclick: -runClientCode();- (Points to the function in your script that should be run when the UI Action gets clicked)
function runClientCode(){
// Call the UI action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'create_defect');
}
if(typeof window == 'undefined')
runBusRuleCode();
function runBusRuleCode(){
var defect = new GlideRecord('rm_defect');
defect.initialize();
// Customize below all fileds as needed
defect.short_description = 'Defect related to Story: ' + current.number;
defect.description = 'Description of the defect...';
defect.story = current.sys_id; // Link the defect to the current story
defect.insert();
action.setRedirectURL(current);
}
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2023 02:55 AM - edited ‎10-01-2023 02:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2023 03:07 AM - edited ‎10-01-2023 03:08 AM
Hi @Balakrishna_ABK ,
Uncheck client checkbox and try make sure the fields mapped correctly in script defect table and also add action name in script and ui action as well.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2023 03:34 AM - edited ‎10-01-2023 03:40 AM
defect.story = current.sys_id; // Link the defect to the current story
this line is not working