Add Event handler once the record is saved in kb_feedback table
- Goto Data Resources
- Select Create Record 1
- Goto Events Section
- Expand Operation Succeeded event (This will be triggered after successful DB operation)
- Click Add New Event Handler
- Select Handler Star rating from the scripts section
- Click Save
Update the Script to handle Operation Succeeded event
- Goto Page Scripts
- Open Handler Star rating Script
- Append the following snippet
if (event.elementId == "create_record_1") {
var items = [];
var requestFailed = false;
if (event.name == "DATA_OP_SUCCEEDED") {
var output = event.payload.data.output.data.GlideRecord_Mutation.insert_kb_feedback;
if (output == null) {
requestFailed = true;
} else {
items.push({
id: "ratingArticleSuccess",
status: "info",
icon: "info-circle-outline",
content: "Feedback submitted.",
action: {
type: "dismiss"
}
});
}
}
if (event.name == "DATA_OP_FAILED" || requestFailed) {
items.push({
id: "flagArticleFailure",
status: "critical",
icon: "info-circle-outline",
content: "Technical issue submitting a feedback. Try again later",
action: {
type: "dismiss"
}
});
}
if (items.length > 0) {
emit("NOW_UXF_PAGE#ADD_NOTIFICATIONS", {
items
});
}
}
Note: In the next post, We will walk through the entire code to understand how exactly this works. You should see a feedback text once you select the star rating
![](https://gblobscdn.gitbook.com/assets%2F-MThcABm72pwqrTwT27D%2F-MUbYNnv7iCfLij1CaG6%2F-MUba8QMXJiVHowMUuIR%2FKnowledge_page_3.png?alt=media&token=098b0927-efaa-4e2c-a68a-4d96eb34f131)
Great!! We have successfully added confirmation message on feedback submission rating to kb_feedback table