Forms - Custom Workflow that created block items?
# help-with-umbraco
o
Has anyone tried this before? I have a form, and I have workflow that creates a node in the backoffice when someone answers the questions. I can assign the input fields to strings in the backoffice however, I can't create a RTE block and then put the answers given in to that block. It would be super useful if there was a way to do this but right now, I can't think of a way to do it. Anyone got any ideas? Alternatively, I'll just save all the user input in to a text area on the node and then copy/paste it manually in to the block I need it in. https://cdn.discordapp.com/attachments/1252182155686056000/1252182155874930698/image.png?ex=66714902&is=666ff782&hm=49c01262bb8d7acc6df6ee922e6f438ee794e57559f6292e5d9b8d940519b701&
l
I did something similar recently, sounds like youre looking to programmatically create blocks on a page somewhere? If so, let me know and ill dig some code out as there are a few quirks, also, this on version 13?
o
Ye, that's exactly it @Lewis Heaton - Someone fills in the form input fields, I then take those fields, programmatically create the node (which can be done in Workflow) and then assign the replies from different fields to corrosponding blocks. V13 yup.
l
Okay, first off i found this from another thread. Creating blocks is semi painful, expecially if you get into nesting blocks in blocks, it all becomes a json mess. This link to get you started, then ill copy some code i have, will need an hour or so to get grab that https://gist.github.com/DanDiplo/1e8e4dcd93bcc29115ef16c62e3d090a
One thing to note, not sure if its a known bug, but when i was creating blocks programatically, it would not work with labels, didnt throw errors, just didnt populate them, its a fun (annoying) gotya
The code ill copy is just a working class that arguably is not as good as the link above, so let me know if youre happy with above
o
Amazing. Thanks for the help. Great starting point.
l
So checked my code, does the same as the link, did you managed to get things up and running @Owain?
o
Not yet, it's for my personal blog so will need to now find time to give it a go 😄