Create button to update current records

Priti18
Tera Expert

I want to update current records in cmdb_ci table  but when user clicks on the UI action it should open the comment box and when user clicks on ok it should update data along with that comment in short description.

 

can anyone help me with this requirement, that would be really helpful.

 

thanks!!

1 ACCEPTED SOLUTION

Please try the below script:

 

 

function UpdateData() {


    var answer = confirm('Do you want to update this record');

    if (answer) {

        gsftSubmit(null, g_form.getFormElement(), 'function_name');
    }
}

if (typeof window == 'undefined')

    updateValues();


function updateValues() {

    current.setValue("state", 7);
    current.update();
    var childInc = new GlideRecord("incident");
    childInc.addQuery("parent_incident", current.getUniqueValue());
    childInc.query();
    while (childInc.next()) {
        childInc.state = "7";
        childInc.comments = "Your comments here";
        childInc.update();
    }
    action.setRedirectURL(current);
}

 

I hope this help.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

View solution in original post

15 REPLIES 15

thank you it worked 🙂