Hi everybody!
I’m currently facing an issue with my workflow using web forms. I have a web form used to apply to job offers. This web form, as it should, stores the information by creating a new document in a DocType.
An user submits the web form “Applicant” > New document is created in the Doctype “Applicants”
Until now everything goes right. The “Applicants” DocType has a Custom Script assigned to it that triggers using after_save and creates a new document in another Doctype using information stored in the current document. For example, “Applicant” has a field “name” and I want to copy “name” into “Interested person”. This works correctly but in order to do it I should enter the document and click on save.
(1) An user submits the web form “Applicant” > (2) New document is created in the DocType “Applicants” > (3) I click “save” on the document inside “Applicants” > (4) New document is created in the DocType “Interested Person” with data from “Applicants”.
So, the solution I’m looking for is that when a Web Form (“Applicant”) is submitted, a new record is created in the Doctype linked to the Web Form (“Applicants”) and AUTOMATICALLY in the DocType targeted through Custom Script(“Interested Person”). This mean skipping step 3 and end with this workflow:
(1) An user submits the web form “Applicant” > (2) New document is created in the DocType “Applicants” > (3) New document is created in the DocType “Interested Person” with data from “Applicants”.
Is like changing the trigger “after_save” to something like “everytime a new doc is created from the web form”.
I need to accomplish this via client side scripting. Hope I was clear enough.
Thanks