Forum OpenACS Q&A: Automatic assignment in ACS_Workflow

Hi all,

I'm posting this because I've spent a good while tracing through
source code to see where calls are being made etc. and I can't get
this to work.

I'm trying to set up a workflow such that the default assignee for a
category is autmatically assigned to the case, just like the default
ticket-tracker does.

I've done this by adding the call:
insert into wf_context_role_info
(context_key,
workflow_key,
role_key,
assignment_callback,
assignment_custom_arg)
values
('default',
'kevins_test_workflow_wf',
'manager',
'ttracker_callback.assign_task_to_assignee',
'');

to my workflow-create script.

However, if I do this, I get the following error:
ora8.c:3930:ora_tcl_command: error in `OCIStmtExecute ()': ORA-02291:
integrity constraint (OPENACS.WF_CASE_ASSIGN_ROLE_FK) violated -
parent key not found
ORA-06512: at "OPENACS.WORKFLOW_CASE", line 185
ORA-06512: at "OPENACS.TTRACKER_CALLBACK", line 65
ORA-06512: at line 1
ORA-06512: at "OPENACS.WORKFLOW_CASE", line 1171
ORA-06512: at "OPENACS.WORKFLOW_CASE", line 1683
ORA-06512: at "OPENACS.WORKFLOW_CASE", line 1307
ORA-06512: at "OPENACS.WORKFLOW_CASE", line 269
ORA-06512: at "OPENACS.TTRACKER_TICKET", line 60
ORA-06512: at line 6

SQL:

    declare
        v_ticket_id  acs_objects.object_id%TYPE;
    begin
        v_ticket_id := ttracker_ticket.new (
            context_id    => :package_id,
            subject      => :subject,
            description  => :description,
            mime_type    => :mime_type,
            category_id  => :category_id,
            severity      => :severity,
            priority      => :priority,
            creation_user => :user_id,
            creation_ip  => :creation_ip
        );

        acs_permission.grant_permission(
            object_id  => v_ticket_id,
            grantee_id => :user_id,
            privilege  => 'write'
        );
    end;

It's as if I had spelled my role_key or workflow_key wrong, but I
have these defined correctly at the top of my script.

Any ideas?

Thanks,

Kevin

Collapse
Posted by Dave Bauer on
It looks like the role_code you are trying to use does not exist in wf_roles.
Collapse
Posted by Kevin Crosbie on
That was one of the first things I checked, because the constraint OPENACS.WF_CASE_ASSIGN_ROLE_FK definitely points to that.  That is why I'm having trouble figuring this problem out.  That constraint says that either the workflow_key or role_key in wf_roles does not exist, yet I can see when I do 'select * from wf_roles' that they are there.