Expand section break programaticaly

I have added a section break to an existing form.
I am able to add a code snippet such that when a link is clicked my section break expands

Which works fine.

I would like to do this automatically in
frappe.ui.form.on(‘Sales Invoice’, {
refresh: function (frm) {

but it never does anything. I see the console message. The section remains collapsed
I have also tried onload and onload_post_render

Does anybody know when the docuement is actually ready.