locked
CallExternalMethod is not called RRS feed

  • Question

  • Hi!

    Good Day!

    I'm new to WF and so far I have developed a sequential workflow, something like a helpdesk application, and I would like to ask for your help regarding some issue that I encountered.

    Basically what the system does is the system will wait til a User creates a ticket. Then it will be approved or disapproved by another user (Approver). If the ticket has been disapproved, the system will send the User the status of the ticket. But if the ticket has been approved it will go then to another user (Provider) to give solution or escalate it. Then it will send the status to the User.

    Here the problem goes, the CallExternalMethodActivity is called only if I press the button twice to Approve the ticket, which internally calls up a method in the service to fire the event. Below is a sample code of it:

        WorkflowInstance instance = this.GARMCOWFRuntime.GetWorkflow(id);

        // Fire the event

        GARMCOHelpdeskService helpdeskService =  this.GARMCOWFRuntime.GetService<GARMCOHelpdeskService>();

        helpdeskService.RaiseApproveServiceRequest(id, note, approvedBy, true,

        ConfigurationManager.AppSettings["smtpServer"].ToString(),

        ConfigurationManager.AppSettings["webSite"].ToString());

        ManualWorkflowSchedulerService scheduler = this.GARMCOWFRuntime.GetService<ManualWorkflowSchedulerService>();

       scheduler.RunWorkflow(instance.InstanceId);

     

    And here's the code that was called

        public void RaiseApproveServiceRequest(Guid id,

        string note, int approvedBy, bool approveStatus, string smtpServer, string webSite)

        {

        // Raise event in the workflow

        ThreadPool.QueueUserWorkItem(JustApproveServiceRequest,

    new GARMCOHelpdeskServiceReqEventArgs(id, note, approvedBy, approveStatus,

    smtpServer, webSite));

        }

     Hope you guys can help me with this. Thanks a lot in advance!  

    Tuesday, November 21, 2006 4:47 AM

Answers

  • Since you are using the ManualWorkflowScheduler, I would remove the ThreadPool.QueueUserWorkItem and just enqueue the data to the workflow.  Then when you run the workflow using the manual scheduler, it can do so on its thread. 

    Matt

    Tuesday, November 21, 2006 3:56 PM

All replies

  • Since you are using the ManualWorkflowScheduler, I would remove the ThreadPool.QueueUserWorkItem and just enqueue the data to the workflow.  Then when you run the workflow using the manual scheduler, it can do so on its thread. 

    Matt

    Tuesday, November 21, 2006 3:56 PM
  • Try call WorkflowInstance.EnqueueItem directly.

    Shelly Guo

    Tuesday, November 21, 2006 5:51 PM
  • Thank you guys for the help.

    May you give me some sample code where and how to call this method. Sorry, I'm just new in WF. :D

    Thursday, November 23, 2006 12:32 PM
  • Disregard my previous post already :D... i was able to resolve the issue by removing the ThreadPool and rather call the event instead.

    Thanks a lot! :D

    Thursday, November 23, 2006 1:17 PM