Workflow – Detailed Development

Ok.. My previous write-ups included installing and configuring workflows and brief description for developing workflows. I got some time to create a document which explains in detail about how to develop workflow artifacts.
 
I have taken an example of Purchase order invoice approval process.
 
Here is the document Workflow – Development
 
Here is the link to the sample XPO of the scenario Purchase order approval project
 
Note: There are some existing objects that have been modified. The user should take care while importing the project and look for possible conflicts that may arise.
 
See Also:
 
 

31 thoughts on “Workflow – Detailed Development

  1. This Development document helped me a lot and my work finished smoothly.Thank you very much Summit, for taking the time to write this document and sharing with us. 🙂

    Like

    1. Hi Santosh,
      In my case yellow bar is not coming. Any suggestion?
      can you share your objects so that i can compare it with my objects

      Like

  2. Dear Sumit,

    Your document on work flow creation has helped me a lot.
    But i am facing problems while creating condition for purchase order approval while configuring the work flow which i created.
    I have used the code and steps which you have given in the document.

    My error is,
    Error executing code: TaxPurch object not initialized.

    (S)\Classes\TaxPurch\totalCustomsDuty_IN
    (S)\Classes\PurchTotals\displayFields – line 91
    (S)\Classes\PurchOrderDocument\parmTotalAmount – line 8
    (S)\Classes\DictClass\callObject
    (S)\Classes\SysExpression\buildXmlDocument – line 112
    (S)\Classes\SysExpression\buildXPathDocument – line 49
    (S)\Classes\SysExpression\evaluate – line 103
    (S)\Classes\SysWorkflowExpression\evaluateWithoutInstance – line 65
    (C)\Classes\FormButtonControl\Clicked – line 10

    I can not find the solution.
    Please help me in this if possible.

    Thnx,
    Kirtan

    Like

  3. Above error has been solved!!

    Now the yellow bar is not appearing on the purchase order form.

    How to solve this problem???

    Kindly Reply

    Like

    1. On the Purchase order form, please check what the method, canSubmitToWorkflow is returning. Also ensure that there is a data source specified for WrokflowDataSource property on form design.

      Like

  4. Hi sumit!!!I have developed the workflow on sales quotation form.
    On that form work flow is working properly.
    Now need to customize for approval procedure!
    Is there any proper document available for that??
    If yes can you share it??

    Like

  5. Thanks Sumit for this Post. I follow your post regularly now and your contents and presentations are awesome.
    Keep doing good work…

    Like

  6. Dear Sumit,

    Thank you so much for your pdf on workflows-development. I wanted to try this xpo given here but i am having this error when i try to download it. I would highly appreciate if you can reactivate it. Thanks a lot

    [Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in /home/axaptapedia/www/www/includes/Namespace.php on line 46]

    Like

  7. Dear Summit,

    Iam trying to create a EP workflow, but i strucked up with an error following error when i click Submit button in workflow:

    Dynamics Object Adapter Call failed.
    Error executing code: EPWorkflowControlContext object not initialized.

    (C)\Classes\

    EPWorkflowControlContext\getWorkflowComment
    (C)\Classes\EPSTSLeaveWFActions\submitToworkflow – line 22
    (C)\Classes\EPSTSLeaveWFActions\dispatchWorkItemAction – line 8
    (C)\Classes\EPSTSLeaveWFActions\main – line 22
    (C)\Classes\WebActionMenuFunction\run

    I think SubmitToWorkflow class is not executing, even i could not able to debug x++ code when am using EP to trace error.

    Please help me, i googled it but could not find solution, can you please help me..

    Like

  8. Hi Ramabala,

    Looks like you are not passing the workflow context as expected. In EP there is a concept of contexts that passes the selected record from one webpart to another or to an action. For more information, check the Expense approval on EP. You can check expenses from EP -> Employee services -> Manage expenses.

    There when you create an expense and configure a workflow, you can submit it for approval. You can take some cue from that web part and see the context passing.

    Regards,
    Sumit

    Like

    1. ok.. i will check it.. Thanks for your reply.

      i installed and configured EP on a instance, later i installed one more instance of Ax 2009, now when i open VS and started working, in AxDatasource control, datasetName property is pointing to list of all datasets of 2nd instance instead of 1st instance. How to configure VS to point to a specific instance of Ax09?

      Please guide me..

      Like

  9. Hi Summit i have done all the work flow developement from you link above and installation,settings on accounts payable- purchase order form, but i can’t see the work flow ribbon on the form, can you help?

    Like

    1. Are you checking them in existing POs or did you try to create new ones? If they are existing POs, then you may have to set their Workflow state field to “Not submitted”. The new ones will have this field set as Not submitted and then it should be visible

      Like

  10. I have submitted a purchase Requisition record to the workflow.But in the Workflow history form the status Pending.My record is not submitting to the work flow.I don’t know what is the problem in that.I have to change any settings in the server.

    Like

    1. Hi Rahul,

      Can you check the tracking and see if the workflow remains in the activated state? If that is case, try following:

      1. Check the event log on AOS (there will be separate application log for Workflows) for possible errors. Try and search the errors on the net and you might find the solution
      2. From Basic –> Setup –> Settings for workflow, try and validate the URL and see if passes validation

      Like

  11. HI Sumit,

    I have in all 21 workflows configured, all are running properly. But sometimes the approval starts and the workflow work item is not created, the workflow gets stuck. I have configures batches properly and they are not going into error, hierarchy of the user is also proper. also the service is not restarting and the workflow IIS is also running properly. I have checked the event log of batch-AOS server as well as IIS server but fount nothing.

    The amount approval for workflow is less then 1000 and we have applied the KB2398999 patch.

    I am using AX 2009 with sp1. Can you please suggest what might cause this problem.

    Like

  12. Hi Sumit,
    One of my client want to develop New PO workflow for ax2009.
    I have followed your document but the yellow bar in the purchtable form is not visible.
    I have tried many times to check the steps which i follow. but no luck.

    Request you to please suggest me what should i do?

    Thank you!

    Like

      1. Thank you for reply!
        Yes I have configured.
        I noticed one thing when i am validating the URL settings for workflow it gives me error message like unauthorised URL… is this the problem?

        Like

      2. One more thing if possible please can you send your xpo so that i can compare it with my objects

        Like

      3. Now yellow bar is coming now.
        just modified the code

        public boolean canSubmit()
        {
        PurchLine purchLine;
        boolean ret = true;
        ;

        //Items has been received
        // ret = ret && (this.PurchStatus == PurchStatus::Received); // Commented this line

        //Purchase order is not already submitted to workflow for approval
        ret = ret && (this.State == PurchReqWorkflowState::NotSubmitted);

        //There is atleast one line for the purchase order
        select firstonly RecId from purchLine where purchLine.PurchId == this.PurchId;

        ret = ret && (purchLine.RecId != 0);

        return ret;
        }

        Like

  13. Hi Sumit,

    This could come in really handy. Would you mind sharing the project (.XPO) with me?

    Best regards
    Jonas Lobo Vedel

    Like

Leave a reply to rama Cancel reply