I’ve been running around in circles how to concatenate two fields together for use in the title of a doc. All I’m trying to do is get field first_name
, and field last_name
to look like, say first_name
is “jon”, last_name
is “doe” I want the resulting title to be “jon doe”. how can I do this?
Into the options of the title field put
{first_name} {last_name}
Can title be a hidden object?
Just tried this in V13 but it returns an “Invalid Data Field” error
Any other suggestions pls?
When I put it in the options, I have the error:
Title is an invalid Data field.
Only Options allowed for Data field are:
* Email
* Name
* Phone
* URL
* Barcode
I have same problem, like author
Do you find solution?
I need help with that.
Still doesn’t work as far as I’m aware. You may need to resort to Custom Scripts
I need just title in format like this
{last_name} {first_name}
howto create Custom Script for it?
Try this. Make Title field as Data fieldtype and include this in your .py file.
def validate(self):
self.title= ' '.join(filter(None, [self.last_name, self.first_name]))
Thanks, but will it works after erpnext update? Or Should I insert it something else?
Can I use it through app/server-script ?
Or how to do it and save update erpnext?
{fieldname} in option or default not working for v13. The documentation needs update.
Hi @max_morais_dmm
Can you check whether this still works in a newer installation you have access to (ideally V13)?
What you are suggesting is exactly what is described in the documentation: Document Title with multiple fields
For me this approach does not work. This is what I set:
This is what I get in the doctype:
Did this break in the meanwhile or do I do something wrong?
(I am on ERPNext: v13.49.4 and Frappe Framework: v13.51.0)
While the read-only
field type seems to be broken (at least on my version), one can circumvent it and concatenate fields using the HTML
field type. Then one will need to use Jinja tags. They are formatted slightly differently but not very complicated. In my example above it would be {{doc.bank}} {{doc.company}}.
(no idea whether I made something wrong with the read-only
fields or whether there is a bug in newer versions.)
in current situation this is only one solution which working…