Forum OpenACS Development: Re: how to get the resolver_id from a role?

Collapse
Posted by Deds Castillo on
It's returned as a list using the workflow::case::role::get_assignees api. This is used by workflow::case::role::set_assignee_values and extracts the first element to set it during display mode.
Collapse
Posted by Dave Bauer on
Or, I was wrong and Deds knows exactly how it works....
Collapse
Posted by Iuri Sampaio on
Deds,

workflow::case::role::get_assignees
workflow::case::role::set_assignee_values

Both procs use case_id as parameter and i don't have it from advance. I have only workflow_id, role_id and bug_id

How would i get the user_id of the resolver in the display mode?
I want to get the user_id, to pass it as parameter of an API, to use it in another field of the ad_form.

something like:

workflow::role::add_assignee_widgets -workflow_id $workflow_id -form_name bug -roles resolver

which is the API that returns the the ad_form element of the resolver on display mode.

Then i want to use the resolver info, only user_id.

ad_form -extend -name bug -form {
{item:text(select),optional
{label "Equipment"}
{options {[bug_tracker::get_items -user_id $role_resolver(user_id) -bug_id $bug(bug_id) -workflow_id $workflow_id]}}
{mode display}
}

I created the API bug_tracker::get_items
Attention to parameter $role_resolver(user_id)
This is a guess! Precisely what I am trying to figure out.

How to access the data structure (ad_form element) that holds the resolver info, in order to use it?

Collapse
Posted by Deds Castillo on
Iuri,

You can get the case_id so that you can use it as parameter to workflow::case::role::get_assignees in addition to role_id.

Check the code in bug-tracker/www/bug.tcl then just use your values for bug_id

set case_id [workflow::case::get_id -object_id $bug(bug_id) -workflow_short_name [bug_tracker::bug::workflow_short_name]]

Collapse
Posted by Iuri Sampaio on
Deds and Dave,

Problem solved. I ended up creating an API
ad_proc bug_tracker::get_items

the main part of it is:

set role_id [workflow::role::get_id -short_name $role -workflow_id $workflow_id]

set user_id [lindex [lindex [workflow::case::role::get_assignees -case_id $case_id -role_id $role_id] 0] 3]

the rest, i followed your tips above in this thread to get the parameters here and there

Thanks a lot!