Hello All,
I have created custom fields in HD Ticket and HD Customer. The custom fields created in HD Ticket are displayed using the HD Ticket Template > Default, where I added the list of fields to show in the form view.
However, for HD Customer, how can I display the custom fields in the form view?
Also, how can I write a script to fetch the date value from the HD Customer record into the HD Ticket, and validate it so that if the HD Customer’s date is expired, the HD Ticket cannot be created for that customer?
Hello all,
can any one help me on this?
Regards
Nivedha
Hello
,
Next time Please attach some screenshot as well it helps to understand the context of problem.
I’m able to understand that you have a date field in HD customer and you want that when you create and select the HD Customer in HD Ticket creation time so it fetches that date field and then if try to save so validation will happen.
I’m assuming you know about Fetch From.
So for this,
First use the Fetch From in HD Ticket and get that date field value in that.
On backend side,
def validate(self):
if self.date_field_name and self.date_field_name < today():
frappe.throw(f"Cannot create ticket.")
Hi @raj_007,
Thank you for your kind reply. I have added a “fetch from” to the HD Ticket doctype to get the expiry date from the HD Customer doctype. In the Desk view, the data is fetched correctly, and the validation works as expected.
However, in the Web View, the expiry date field from HD Customer is not displayed, and it doesn’t fetch the value when selecting a customer. How can I write a script to fetch the expiry date and apply validation in the Web View?
I have attached a screenshot below for reference.
Regards
Nivedha
Okay Cool,
Now search the WebForm Doctype and there you can add these fields which you want to show in WebForm.