def rebuild_case_from_actions(case, actions): strategy = ActionsUpdateStrategy(case) strategy.reset_case_state() # in addition to resetting the state, also manually clear xform_ids and actions # since we're going to rebuild these from the forms case.xform_ids = [] case.actions = actions # call "rebuild" on the case, which should populate xform_ids # and re-sort actions if necessary strategy.soft_rebuild_case()