Carlos,
There are a couple of things that you have to do to get the side effect callback to work.
First you need to register your implementation.
ad_proc -private curriculum_central::install::register_uos_go_live_impl {} {
Registers a service contract implementation for UoSGoLive.
} {
set spec {
name "UoSGoLive"
aliases {
GetObjectType curriculum_central::uos::object_type
GetPrettyName curriculum_central::uos::go_live::pretty_name
DoSideEffect curriculum_central::uos::go_live::do_side_effect
}
}
lappend spec contract_name [workflow::service_contract::action_side_effect]
lappend spec owner [curriculum_central::package_key]
acs_sc::impl::new_from_spec -spec $spec
}
The above proc gets called after a package instantiation from a callback specified in the .info file. It registers an implementation of the workflow::service_contract::action_side_effect service contract.
My implementation UoSGoLive sets content items as live revisions when the "close" workflow action is executed. So the next thing you need to do is assign the side effect implementation to your workflow spec as follows:
close {
pretty_name "<span>#</span>curriculum-central.close#"
pretty_past_tense "<span>#</span>curriculum-central.closed#"
assigned_role { stream_coordinator }
assigned_states { submitted }
new_state closed
privileges { write }
callbacks {
curriculum-central.UoSGoLive
}
}
Take note of the callbacks component of the spec. I make a reference to my implementation of the side_effect contract called curriculum-central.UoSGoLive, where "curriculum-central" is the package key as returned by [curriculum_central::package_key].
Once this is done you can then implement the aliases GetObjectType, GetPrettyName and DoSideEffect.
ad_proc -public curriculum_central::uos::object_type {} {
Get the short name of the workflow for Units of Study.
} {
return "cc_uos"
}
ad_proc -private curriculum_central::uos::go_live::pretty_name {} {
return "[_ curriculum-central.go_live]"
}
ad_proc -private curriculum_central::uos::go_live::do_side_effect {
case_id
object_id
action_id
entry_id
} {
# Make the content item go live.
}
The above do_side_effect proc will get interpreted when the "close" action is executed. So you can put anything in that proc that you want done when the "Close" action button is pressed from ad_form.
Hope that helps.
Cheers,
Nick.