Skip to content

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

Open
Shindhu-Ramaswamy wants to merge 13 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 13 commits intofrappe:developfrom
Shindhu-Ramaswamy:fix/available-agents-only

Conversation

@Shindhu-Ramaswamy
Copy link
Copy Markdown

@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.

The signature is auto append to all ticket replies.

  1. Assignment UI Improvement

When assigning a ticket:

Only available agents are shown in the Assign To dropdown.

Prevents accidental assignment to away agents.

4.Made the two fields visible in settings Modal .

Summary

Adds agent availability status and email signature support to Frappe Helpdesk. Agents can now set their availability and a personal signature from their profile settings. The assign dropdown filters out unavailable agents, and the signature is automatically appended to all outgoing ticket replies.

#issue #2872 – Enhance Agent’s Profile

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.02%. Comparing base (0d4ca83) to head (c4e2b65).
⚠️ Report is 80 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3002      +/-   ##
===========================================
+ Coverage    51.23%   55.02%   +3.79%     
===========================================
  Files          122      128       +6     
  Lines         5420     6015     +595     
===========================================
+ Hits          2777     3310     +533     
- Misses        2643     2705      +62     

☔ 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 +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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

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

@RitvikSardana
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

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

@RitvikSardana
Copy link
Copy Markdown
Member

image

Since we are throwing error now, the customer is not able to raise the ticket

watch,
} from "vue";
import SavedReplyIcon from "./icons/SavedReplyIcon.vue";
import { computed, nextTick, onBeforeUnmount, ref, watch } from "vue";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

already imported in line 203, can be removed

Comment on lines -329 to -332

if (isManager) {
updateOnboardingStep("reply_on_ticket");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this removed?

ccEmails: string[],
bccEmails: string[]
) {
function addToReply(body, toEmails, ccEmails, bccEmails) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why have you removed the types for each param?

@RitvikSardana
Copy link
Copy Markdown
Member

image

This is my signature
only two line

image

Getting an extra line in the editor, is it intentional?

Comment on lines +46 to +47
frappe.logger().debug(f"Signature for {current_user}: {signature}") # 👈 add this
print(f"Signature for {current_user}: {signature}") # 👈 add this
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why the print statement and
add this comment?

Comment on lines +41 to +45
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

now if this agent is assigned a ticket the customer is unable to raise a ticket

Image

Comment on lines +69 to +77
"ToDo": {
"before_insert": "helpdesk.overrides.assign.validate_agent_availability",
},
"HD Ticket": {
"validate": "helpdesk.overrides.assign.validate_hd_ticket_agent",
},
"ToDo": {
"before_insert": "helpdesk.overrides.assign.validate_agent_availability",
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why 2 todo overrides?

@RitvikSardana
Copy link
Copy Markdown
Member

Once you resolve these issues
let me know @Shindhu-Ramaswamy

we can have a call then

@niraj2477
Copy link
Copy Markdown
Contributor

Man I'm finding the PRs for feature , which is needed 🥇.
Is this going to be part of next release?

@Shindhu-Ramaswamy
Copy link
Copy Markdown
Author

@RitvikSardana i made the changes in the code , kindly review it , let me know your feedback

@RitvikSardana
Copy link
Copy Markdown
Member

image

After giving the same feedback many times this issue still persists, I dont think I will be able to go ahead and arrange a call

@Shindhu-Ramaswamy Shindhu-Ramaswamy force-pushed the fix/available-agents-only branch from 09256cf to ae9e1c9 Compare March 25, 2026 09:59
@Shindhu-Ramaswamy Shindhu-Ramaswamy force-pushed the fix/available-agents-only branch from ae9e1c9 to c4e2b65 Compare March 25, 2026 11:47
@RitvikSardana
Copy link
Copy Markdown
Member

@Shindhu-Ramaswamy

is this complete?

@Shindhu-Ramaswamy
Copy link
Copy Markdown
Author

Shindhu-Ramaswamy commented Mar 25, 2026

@RitvikSardana now i came with different approach
I added two fields in hd_agent availability status and signature

  1. I added a new filter in AssignToBody.vue . Tells that search_link to only return agents where Available in the DB. The Away agents disappear from the dropdown.
  2. I also made code changes in ticket reply section, when we click the reply box, the signature automatically appends in reply section which is not editable and also customer receives the email with signature .

Is there any better alternative approach ?

@wsslmn
Copy link
Copy Markdown

wsslmn commented Mar 31, 2026

@Shindhu-Ramaswamy we started using the helpdesk, and I started digging into the features. Thank your for all the work 🙏

For the away status and ticket assignment, my suggestion would be to give agents the following settings:

  1. Working schedule settings to set which part of the working days they are not available
  2. A vacation option to set multiple days away

Both add a more flexible way to set the away status over a longer period.

@RitvikSardana
Copy link
Copy Markdown
Member

Hello @Shindhu-Ramaswamy

This works much better now.

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.

4 participants