3

List A has an approval workflow running behind.

List A has columns "x","y" and "z" as mandatory fields.

Approvals are sent to "user1" then "user2" and finally "user3".

The creator of the list item fills the columns x,y and z and submits the item which triggers the approval workflow.

The following functionality is needed

User1 gets the email to approve, but it should be mandatory for him to fill columns "p","q" and "r" before he approves the item.

User 2 then gets to approve but it should be mandatory for him to fill the columns "l","m" and "s" .

Can this be achieved using SharePoint designer 2010.

The whole scenario is also based on SharePoint 2010. Is there any workaround for this.

4

This is a good use case for InfoPath. IP has "rules" that enable to do things like enable/disable or show/hide fields based on a condition, or make fields required based on a condition. So you could put fields l, m, and s in a section, and configure the section to only be visible when the form has a certain status (the status would be a field set up in the form that would change for each step of the workflow). Those fields could also be marked to be required only when the status is a certain value.

You could do all of the above with SPD, but that would require javascript or XSL. The XSL might not be too bad in SPD 2010, but when you migrate to 2013, maintinging this form would become far more difficult. So I'd go the infopath route.

edit: Another, easier option I should have mentioned earlier is to use list validation. This is found in list settings --> validation settings. You can configure simple expressions, like [amount]>0, or you can use if statements. For example:

=IF([stage]="submitted",if([somefield]<>"",true,false),true)

In the above, if the stage field has a value of "submitted", then it checks the value of "somefield". If somefield is not empty, then the validation passes (true), else the validation fails (false). if the stage wasn't "submitted", then the validation passes (the last true).

An additional option would be to customize the editform.aspx page, and add javascript to conditionally make the field required.

  • Are there any links that I can refer to in order to implement this, I don't have the resources now, I might have to do it using the XSL as this has to be achieved using SharePoint designer. – CodeAbaddon Sep 12 '17 at 13:43
  • Again, I strongly recommend against the xsl route. SPD 2013 has limited functionality in this area, and all changes must be done via code. IP is an easier alternative, but users would likely want to fill in the form in their browser, which requires SharePoint enterprise. So the first step for this would be to check with IT to see if you have access to it. Another, easier option is list validation. I've edited my original answer with an explanation and example for that. – Mike2500 Sep 12 '17 at 14:04
  • I tried your validation code but it gives me syntax error. – CodeAbaddon Sep 12 '17 at 15:52
  • I just copied and pasted the code from this post and it worked fine. I assume you replaced "stage" and "somefield" with actual field names? Can you paste in the exact code you tried to use? – Mike2500 Sep 12 '17 at 15:54
  • my bad, i checked it again and It did worked perfectly, worked like a charm. Thank you. – CodeAbaddon Sep 12 '17 at 15:56
0

While infopath is one way to go, I personally would prefer to use content types instead. It would be a 100% OOTB way to handle your request (as opposed ot infopath that has a somewhat questionable future).

Simply create one content type with the required fields (mandatory or not depending on the use case) for each approver and have the workflow change the content type before moving on to the next approver.

If you want to up the ante a bit you hide the "Change content type" field on the edit form in order to prevent the users from changing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.