So is the Recipient field a reference to the Department table? I'm trying to understand why the business rule is running on the Department table. It looks like you are running it whenever that u_ocir_shared_service_recipient field changes. 

 

So what is happening right now is that the u_ocir_shared_service_recipient field on the Department changes... Let's say it changes from false to true. 

 

So you want the business rule to run and pull any records on the "u_cmdb_ci_capability_provisioning" table with that same Department in the Recipient field??? Because that's not what the script is doing right now. Right now, you are trying to look up the records with a capability and provider, but you don't have that information on the Department table, so you can't do that lookup. 

 

That's where I think I'm confused.

 

From what you said above, I think your script should be doing this:

  • Look up records from u_cmdb_ci_capability_provisioning with the Recipient field the same as the current record that is passed to it.
  • If the current record's u_ocir_shared_service_recipient field is true, then set the Shared Service field to true in all those records found in the lookup above. 
  • If the current record's u_ocir_shared_service_recipient field is false, then for each record from the first lookup, do a second lookup based on that first record's capability and provider. If it finds more than one, set the Shared Services value to true. Otherwise set the Shared Services value to false. 

 

Does that seem right?