What you need is an event receiver. Nothing you've stated above leads me to believe you need a workflow. Look over my blog to see your options:
http://mattbramer.blogspot.com/2012/11/binding-event-handlers-to-sharepoint.html
Domanda
I'm trying to write a sandboxed custom workflow activity that would go to another list and get a value of a field based on values of multiple other fields combined.
List A
(essentially the combination of State and City makes the row uniquely identifiable)
List B
Constrains:
Problem: What I would need is a sandboxed custom workflow activity that triggers on List B item added/changed. When triggered, activity grabs the State and City values from the item in list B, goes to List A and searches for a combination of the same State and City. When found, it grabs the associated population. Lastly it multiplies the population by the % from "Affecting % of population" and pastes that result into the "Population Affected" field.
Bonus: At some point, I will also need a sandboxed custom workflow activity that triggers on List A item changed (the population field). When the population for specific State+City combination changes, the activity would go to List B and update all "Population Affected" fields that satisfy the same State+City for all companies (multiple rows).
Thanks in advance!
Soluzione
What you need is an event receiver. Nothing you've stated above leads me to believe you need a workflow. Look over my blog to see your options:
http://mattbramer.blogspot.com/2012/11/binding-event-handlers-to-sharepoint.html