feat: enhance agent profile with availability status and signature#3002
feat: enhance agent profile with availability status and signature#3002Shindhu-Ramaswamy wants to merge 13 commits intofrappe:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
helpdesk/overrides/assign.py
Outdated
| def user_query_condition(user): | ||
| return """ | ||
| EXISTS ( | ||
| SELECT 1 FROM `tabHD Agent` | ||
| WHERE `tabHD Agent`.user = `tabUser`.name | ||
| AND `tabHD Agent`.availability_status = 'Available' | ||
| ) | ||
| """ |
There was a problem hiding this comment.
this is not needed, you can remove this
There was a problem hiding this comment.
"Fixed in commit 910edf4 — removed the user_query_condition function"
| 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.") | ||
|
|
There was a problem hiding this comment.
this function is not used anywhere, except apply_escalation_rule function, which is deprecated.
| # 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}" |
There was a problem hiding this comment.
There was a problem hiding this comment.
"Fixed in commit 910edf4 — removed backend signature logic, moved to frontend in EmailEditor.vue"
| frappe.ui.form.on('HD Agent', { | ||
| refresh: function(frm) { | ||
| // Example: make status editable | ||
| frm.set_df_property('availability_status', 'read_only', 0); | ||
| } |
There was a problem hiding this comment.
removed the unwanted code
helpdesk/overrides/assign.py
Outdated
| if status == "Away": | ||
| frappe.throw( | ||
| msg=_("This agent is marked as Away and cannot be assigned tickets."), | ||
| title=_("Agent Unavailable"), | ||
| exc=frappe.ValidationError, | ||
| ) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
"Fixed in commit 910edf4 — replaced with frappe.msgprint and frappe.log_error"
|
@RitvikSardana I have made the requested changes. Kindly review and let me know your feedback. |
| <FormControl | ||
| class="w-full md:col-span-2" | ||
| type="textarea" | ||
| :label="__('Signature')" | ||
| v-model="profile.signature" | ||
| /> |
There was a problem hiding this comment.
this should be a TextEditor component
| availabilityStatus: data.availability_status, | ||
| signature: data.signature, |
desk/src/components/EmailEditor.vue
Outdated
| try { | ||
| const res = await getSignature.fetch(); | ||
| signature = res?.signature || ""; | ||
| } catch (err) { |
There was a problem hiding this comment.
no need to do this, we already fetch some user details, get it from there.
desk/src/components/EmailEditor.vue
Outdated
| } | ||
|
|
||
| function addToReply( | ||
| async function addToReply( |
helpdesk/overrides/assign.py
Outdated
| 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") |
There was a problem hiding this comment.
check how assignment rule is being applied for reference
|
@RitvikSardana i had made the changes in the code . please review and let me know your feedback |
desk/src/components/EmailEditor.vue
Outdated
| watch, | ||
| } from "vue"; | ||
| import SavedReplyIcon from "./icons/SavedReplyIcon.vue"; | ||
| import { computed, nextTick, onBeforeUnmount, ref, watch } from "vue"; |
There was a problem hiding this comment.
already imported in line 203, can be removed
|
|
||
| if (isManager) { | ||
| updateOnboardingStep("reply_on_ticket"); | ||
| } |
desk/src/components/EmailEditor.vue
Outdated
| ccEmails: string[], | ||
| bccEmails: string[] | ||
| ) { | ||
| function addToReply(body, toEmails, ccEmails, bccEmails) { |
There was a problem hiding this comment.
why have you removed the types for each param?
helpdesk/api/auth.py
Outdated
| frappe.logger().debug(f"Signature for {current_user}: {signature}") # 👈 add this | ||
| print(f"Signature for {current_user}: {signature}") # 👈 add this |
There was a problem hiding this comment.
why the print statement and
add this comment?
helpdesk/overrides/assign.py
Outdated
| if status == "Away": | ||
| frappe.throw( | ||
| msg=_("This agent is marked as Away and cannot be assigned tickets."), | ||
| title=_("Agent Unavailable"), | ||
| exc=frappe.ValidationError, |
helpdesk/hooks.py
Outdated
| "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", | ||
| }, |
|
Once you resolve these issues we can have a call then |
|
Man I'm finding the PRs for feature , which is needed 🥇. |
|
@RitvikSardana i made the changes in the code , kindly review it , let me know your feedback |
09256cf to
ae9e1c9
Compare
ae9e1c9 to
c4e2b65
Compare
|
is this complete? |
|
@RitvikSardana now i came with different approach
Is there any better alternative approach ? |
|
@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:
Both add a more flexible way to set the away status over a longer period. |
|
Hello @Shindhu-Ramaswamy This works much better now. |








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.
Added a Signature field to the HD Agent doctype.
The signature is auto append to all ticket replies.
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