Skip to content

feat: enhance agent profile with availability status and signature#3002

Open
Shindhu-Ramaswamy wants to merge 8 commits intofrappe:developfrom
Shindhu-Ramaswamy:fix/available-agents-only
Open

feat: enhance agent profile with availability status and signature#3002
Shindhu-Ramaswamy wants to merge 8 commits intofrappe:developfrom
Shindhu-Ramaswamy:fix/available-agents-only

Conversation

@Shindhu-Ramaswamy
Copy link

@Shindhu-Ramaswamy Shindhu-Ramaswamy commented Feb 10, 2026

1.Agent Availability Status

Introduced an Availability Status field for agents (e.g. Available / Away).

This allows the system to clearly distinguish agents who are currently available to take tickets.

  1. Agent Signature

Added a Signature field to the HD Agent doctype.

This can be used in ticket responses and communications.

  1. Assignment UX Improvement

When assigning a ticket:

Only available agents are shown in the Assign To dropdown.

Prevents accidental assignment to away agents.

If an agent is marked as Away, a warning popup is shown during assignment.

  1. Backend Filtering for Assign To

Implemented a custom assign_to_conditions override to ensure:

Agent filtering is enforced at the backend level.

Only agents with availability status = Available are returned in assignment queries.

#issue #2872 – Enhance Agent’s Profile

I completed the corrections .

     ---> both signature and status field  are shown in the settings modal , so agents can view and edit them.
     ---> Fetches agent's signature from DB and auto-fills it in the reply box when opened.
     ---> replaced frappe.throw with frappe.msgprint and frappe.log_error so ticket creation is not blocked.

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.84%. Comparing base (abc5058) to head (910edf4).
⚠️ Report is 29 commits behind head on develop.

Files with missing lines Patch % Lines
helpdesk/overrides/assign.py 77.77% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3002      +/-   ##
===========================================
+ Coverage    50.78%   50.84%   +0.06%     
===========================================
  Files          122      123       +1     
  Lines         5372     5381       +9     
===========================================
+ Hits          2728     2736       +8     
- Misses        2644     2645       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +22 to +29
def user_query_condition(user):
return """
EXISTS (
SELECT 1 FROM `tabHD Agent`
WHERE `tabHD Agent`.user = `tabUser`.name
AND `tabHD Agent`.availability_status = 'Available'
)
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed, you can remove this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed in commit 910edf4 — removed the user_query_condition function"

Comment on lines +427 to +432
def assign_agent(self, agent):
availability = frappe.db.get_value("HD Agent", agent, "availability_status")

if availability == "Away":
frappe.throw("This agent is marked as Away and cannot be assigned tickets.")

Copy link
Member

@RitvikSardana RitvikSardana Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is not used anywhere, except apply_escalation_rule function, which is deprecated.

Copy link
Author

@Shindhu-Ramaswamy Shindhu-Ramaswamy Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed in commit 910edf4

Comment on lines +566 to +569
# Append agent signature if present
signature = frappe.db.get_value("HD Agent", {"user": sender}, "signature")
if signature and signature not in message:
message = f"{message}\n\n{signature}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems counter intuitive, we shouldn't do this.

We should show signature in the reply box in the ticket view, like as soon as an agent opens the reply box in the Ticket View, the signature should be displayed there.

This is how it should be displayed from the agent's signature

Image

Copy link
Author

@Shindhu-Ramaswamy Shindhu-Ramaswamy Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed in commit 910edf4 — removed backend signature logic, moved to frontend in EmailEditor.vue"

Comment on lines 12 to +52
@@ -34,6 +36,21 @@
"in_list_view": 1,
"label": "Is Active"
},
{
"default": "Available",
"fieldname": "availability_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Availability Status",
"options": "Available\nAway",
"reqd": 1
},
{
"description": "automatically added in reply section",
"fieldname": "signature",
"fieldtype": "Small Text",
"label": "Signature"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that these are also shown in the "Profile" tab shown in "Settings Modal" both signature and status field

Copy link
Author

@Shindhu-Ramaswamy Shindhu-Ramaswamy Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed in commit 910edf4 — added both fields to Profile.vue"

Comment on lines +4 to +8
frappe.ui.form.on('HD Agent', {
refresh: function(frm) {
// Example: make status editable
frm.set_df_property('availability_status', 'read_only', 0);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed

Copy link
Author

@Shindhu-Ramaswamy Shindhu-Ramaswamy Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the unwanted code

Comment on lines +15 to +20
if status == "Away":
frappe.throw(
msg=_("This agent is marked as Away and cannot be assigned tickets."),
title=_("Agent Unavailable"),
exc=frappe.ValidationError,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not throw error, we could do frappe.msgprint and frappe.log_error instead

coz let us say if a ticket was about to be created and then it got assigned to an agent who is unavailable, then the system will throw an error and the ticket will not be created. We should not block ticket creation process.

Copy link
Author

@Shindhu-Ramaswamy Shindhu-Ramaswamy Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed in commit 910edf4 — replaced with frappe.msgprint and frappe.log_error"

@Shindhu-Ramaswamy
Copy link
Author

@RitvikSardana I have made the requested changes. Kindly review and let me know your feedback.

@RitvikSardana
Copy link
Member

RitvikSardana commented Feb 27, 2026

image

on changing Signature or Status, the save button is still disabled

On Saving, the changes in these 2 fields are not saved

Comment on lines +120 to +125
<FormControl
class="w-full md:col-span-2"
type="textarea"
:label="__('Signature')"
v-model="profile.signature"
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a TextEditor component

Comment on lines +237 to +238
availabilityStatus: data.availability_status,
signature: data.signature,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is half baked

Comment on lines +366 to +369
try {
const res = await getSignature.fetch();
signature = res?.signature || "";
} catch (err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to do this, we already fetch some user details, get it from there.

}

function addToReply(
async function addToReply(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be Async

Comment on lines +5 to +20
def validate_agent_availability(doc, method=None):
if not doc.allocated_to:
return

status = frappe.db.get_value(
"HD Agent",
{"user": doc.allocated_to},
"availability_status",
)

if status == "Away":
frappe.msgprint(
msg=_("This agent is marked as Away "),
title=_("Agent Unavailable"),
)
frappe.log_error("Ticket assigned to Away agent", "Agent Unavailable")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

I was still able to assign it to the the Agent who is unavailable,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how assignment rule is being applied for reference

@Shindhu-Ramaswamy
Copy link
Author

@RitvikSardana i had made the changes in the code . please review and let me know your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants