- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2022 11:20 AM
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!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 04:31 AM - edited 11-01-2022 04:33 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 03:11 AM
function updateData() {
alert('code is running till here');
current.setValue("state", 7); // this is not updating
current.update();
action.setRedirectURL(current);
}
}
even this is not working it simply refreshes the page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 03:17 AM - edited 11-01-2022 03:19 AM
Comment alert() line it's a client side code, won't work if written outside client function.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 03:25 AM - edited 11-01-2022 03:26 AM
tried
i even put value in quotes and without quotes but everytime it just refreshes the page
i dont even see any error in browser
can you run this code in your instance and guide me
since its just a state field which i need to update through button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 03:30 AM
Please share the final script that you tried executing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 03:39 AM
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();
action.setRedirectURL(current);
}
}