Display different forms based on workflow step

benyamin jain asked on February 5, 2017 12:29

HI

Is it possible to display different forms based on workflow step of currently editing document type?

Say:

there is one document type : custom.request

we apply four step advanced workflow to this document type.

custom.request has two form that each one of them must be displayed on special workflow step.(say we defined two alternative form , the first form has only some sort of fields that must be filled in first step and second form display another part of custom.request fields that must be filled in a special step ).

now , when a user decide to create a document type we display him first form.

user save form and sent it to the next step.

in the current step we want to display second form to the user then user can fill subset of fields that is not displayed in the first form and save data and send it to final step.

Note : existence of workflow is required.wizard can not be used here.we only want to display different views of our document type in context of forms and let them provide us with required information.

Is there any suggestion how we can do this?

Recent Answers


Trevor Fayas answered on February 6, 2017 16:30 (last edited on February 6, 2017 16:31)

If the form is placed via an Online Form WebPart (not widget), you can use a macro for the value of the Form Name.

You would then use the macro engine to get the workflow, something like:

{% if(CMSContext.CurrentDocument.WorkflowStep.CodeName == "Step1") { return "FormStep1"; } #%}
{% if(CMSContext.CurrentDocument.WorkflowStep.CodeName == "Step2") { return "FormStep2"; } #%}

This way the Form loaded will depend on the workflow step. Just be careful the workflow step doesn't change between page cycles (like you submit in Step1, and during the submission it changes to Step 2 on the workflow).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.