CoreBOSBB

Full Version: Update field through workflow ONLY when no related records are present
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a use case where I hope I can use a workflow in stead of coding:

I want to update the field 'dateinservice' in Assets. I have a custom module called 'ServiceJob' that is related to Assets through a M:M relation. Now I want to do the following:

When an asset is saved, a workflow should check if only one ServiceJob is related. If so, the 'dateinservice' field should be filled with a field from that related ServiceJob record. If the no. or related ServiceJob records is 0 or greater than 1, it should do nothing. Do we have a workflow expression function that counts related records, or one that could be 'abused' to do so?
I think you are going to have to create a custom function for that.
Will do and PR it.