Doctype Layout - adding a field

I’m trying to use Doctype Layout to customize the layout of the Leads document, and I’m running into problems. My primary goal is to add a section and column and reorganize fields into the new section. I figure the Doctype Layout document isn’t advanced enough to do that on it’s own, so I added a the section and column break to the form via Customize Form.

First a significant issue with the form:

It isn’t possible to select the Fieldname in the Fields table and fill out the form manually, because the Fieldname doesn’t display any fields in the dropdown. The workaround for this is mentioned here, which I followed with some success.

I have seen the dropdown populated with fieldnames seemingly at random, but to date I haven’t been able to determine what triggered the effect.


With that out of the way, here is my issue: after adding a field via Customize Form, is there any way to add the field to the Document Layout form? There is significant customization in the form already, and starting over is very time-consuming and error-prone. Maybe someone knows what triggered the dropdown to fill out?

2 Likes

Did you figure this out?
As your link says you have to:

  1. Create the New layout and fill in the Name, Document Type and Route
  2. Remove the empty field row from Fields
  3. Try to Save
  4. Add a Row to Fields

And all of the fields will be copied over.
But it doesn’t seem to happen twice, so you have to either:

  • start from scratch with a new Document Layout
  • add in the fields manually

It seems the only way the fieldname dropdown is populated for adding fields manually is:

  • Do a browser refresh of the Document Layout to make sure new custom fields are fetched
  • On the first page of fields, Edit an existing field
  • Use the Insert Below, Insert Above or Duplicate buttons

Et voila the drop-down appears.

Then you can move the field using the Move button or click and drag the field number in the child table.

Maybe you can help me though… Once I’ve modified a layout, it just goes to the standard doctype form. Is there a trick with changing the URL to the new Document Layout route?
Or maybe I have to do a clear-cache or something?

Found the answer here:

  • The route needs to be /app/standard-route/ e.g. /app/sales-order/
  • The Name should match the Doctype Name, otherwise the Go to button takes you to a new list page
  • If on a production-configured site, you also need to do a bench --site <site> clear-cache after the layout is saved
2 Likes

@casesolved-co-uk Thank you so much, Following your instructions, I could see the first-time document layout in a working state. But I could not delete unwanted field in layout, grid delete button is not visible

You should be able to delete fields from the doctype layout.
Either tick the box next to the field you want to delete and the Delete button appears, or use the Edit → Delete button.

If you can’t edit the Doctype Layout, it’s probably a permissions problem. You need to be a user with the System Manager role.

Thanks, However at my side Delete button is not visible; maybe some other reason, let me investigate further

DocType Layouts have been fixed a lot in v14, and v15 introduces a whole new Form Builder which I believe replaces the DocType Layout with a new DocType property which can be overridden with a Property Setter:
field_order
Though v15 still has the DocType Layout doctype