The CreatorCon Call for Content is officially open! Get started here.

Create Defect UI Action

Balakrishna_ABK
Tera Guru

I want to create a 'Create Defect' (rm_defect) UI Action in rm_story form and associate it to that story

4 REPLIES 4

Anand Kumar P
Giga Patron

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

Akhil7842_1-1696154021079.png

 

Akhil7842_0-1696153934815.png

 

hi @Anand Kumar P , thanks for your reply, this UI action is not working

 

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

Hi @Anand Kumar P 

Akhil7842_0-1696156669684.png

 

defect.story = current.sys_id; // Link the defect to the current story

this line is not working