mass update of records in one object because of an update in another object - Forum - Rollbase - Progress Community

mass update of records in one object because of an update in another object

 Forum

mass update of records in one object because of an update in another object

  • What is the best way to do mass updates? Scenario: two objects are related to one another. A field in the first object is updated and with that, a field in the second object has to be updated also. However, not all entries have to be updated, it still depends on a certain criteria. The relationship between first and second object is 1:M so, the trigger "Update Field Value" will not work. I thought "Update Related Records" should do the trick but this trigger triggers all after update triggers of second object which is not appropriate and might cause problems. In this respect, what is the best way to implement this scenario? (Does my question even make sense?)
  • OK, you have objects A and B with 1-N relationship. But you only want to update related Bs with amount>1000. So you can write a trigger on A update. Select "Update related Bs". Than write a trigger's formula, something like that:

    if ({!amount} > 1000) return .....
    else return null;

    If this formula returns null, record's field will not be updated. Otherwise it will.
  • I don't understand... there seems to be problems:

    1. The formula return type for "update related records" is boolean; not the type that is needed in the problem (decimal)
    2. the trigger property says "Select related object(s) for which this trigger should run all On After Update triggers." Does it not mean that this trigger will fire "after update" triggers of object B?
  • another thing: "Update related records" trigger does not provide a way to specify which field/s should be updated by the trigger. Even if the formula returns Decimal, it does not state what field to update.
  • You don't need "Update related records" trigger. I'm talking about "Update field value" trigger.
  • hmm.... again, that's a problem. Actually, i first tried "Update field value" trigger. in the "Select record to update: A or related record" only A is in the list. B is not there. That is when I stumbled on "Update Related Records"
  • i had the impression that "Update field value" only changes one record and not records as the description says "Update the value of a Field in this Record or a Related Record"

    anyhow, i will work on this update field value instead. and will test it. will give feedback
  •  The problem is with "Update field value" trigger interface. Though A has relation with B, only A is in the drop-down list in Trigger properties -> select record to update. Thus B's field cannot be updated
  • You're right, sorry for confusion. Currently "Update field value" only works for N-1 or 1-1 relationships (when other side of update is uniquely identified). I can consider this as feature request, will try to accommodate ASAP.
    What's your zone name?
  • alright! thanks for the clarification! will wait for this till it's available. :)
  • This should be available now, please try.