Before we begin, using a workflow I know how to set a field on the initiating record as mandatory.
Goal: Set a field mandatory for only some entries in a sublist.
When creating a sales order, items ordered are added to a sublist. The sales order "Sublist Fields" include fields I want to make mandatory for some items, but not all. The fields in question reference lists used for option selection. Using a workflow, how do I access the fields on a sublist to make the fields mandatory?
Attempts so far:
--Make the referenced lists mandatory: Not ideal. The fields aren't mandatory for all items and without default values certain logic breaks when paired items are added to the sales order simultaneously.
--User Error Action: This seems an acceptable, if not desired, solution. Triggered by "After field edit", it could check the values of the field for the line item and alert the user to provide values. But I've yet been able to find the field to trigger. The available fields are sales order fields and I've not been able to select the sublist fields. This is especially problematic as I'm not editing the field ON the item, but on the sales order entry referencing the item.
As part of this approach, I've added a custom action that iterates over the sublist for validation and returns an error message. My goal was then to use a User Error Action to check the return value (stored in the state). However, I've only been able to trigger the custom action off of "Before Record Submit" which forces the User Error Action to the same point in the flow. Being a server trigger, the User Error Action takes the user to an error screen and they must click back to return. The user then has to re-enter data. Terrible user experience. I would prefer to trigger off of "After Field Edit". I just don't know how to target the fields for triggering.
--Item triggered workflow: I started creating a workflow applied to the item requiring the field. Then I realized I'm not viewing or editing the item record. The current workflow pulls data from the item to prepopulate fields. Thinking it probably wouldn't trigger, I decided to try asking here.
Other thoughts:
Continue with the server triggered "Before User Submit" User Error Action and move the mandatory fields to a more visible location. The idea being help users remember to input values. Is there some way to further accentuate the field? Background color perhaps? It's a terrible user experience, but then perhaps users would quickly get into the habit of inputting the fields. Again, not ideal.
My preferred approach would be to make the fields in question mandatory only for certain lines in the sublist.
Thank you.