locked
SharePoint Designer Workflow Logic RRS feed

  • Question

  • I am trying to build a workflow to update certain dates based on a based date. As far as I know if can only be possible via SPD workflow. Here is the logic:

    • I have three date fields. BaseDate, D1 and D2.
    • Formula for D1 and D2 are:

        D1 = BaseDate + 7 days

        D2 = D1 + 14 days

    When a new item is created or an item is edited, the BaseDate can be empty. The user should have the ability to edit any date (BaseDate, D1 or D2) and the user entered value should take precedence over calculated value.

    I have taken three date type columns and will be updating column based on formula. But am still not able to check for all conditions. Any help would be appreciated for building my formula. I am using MOSS 2007.

    Thursday, February 7, 2013 3:27 AM

Answers

  • Hi,

    Could you please share more details about your requirement? Or will the following workflows work for your requirement?

    BaseDate, D1 and D2. C1 and C2 are 2 calculated columns. BaseDate_Copy, D1_Copy, D2_Copy are 3 date columns.

    D1/C1 = BaseDate + 7 days

    D2/C2 = D1 + 14 days

    SharePoint Designer workflow1 (start when new item is created)
    Update D1/C1_Copy = C1, D2/D2_Copy = C2, BaseDate_Copy = BaseDate

    SharePoint Designer workflow2 (start when item is changed)

    If BaseDate != BaseDate_Copy
    Update D1/D1_Copy = C1, D2/D2_Copy = C2, BaseDate_Copy = BaseDate

    If D1 != D1_Copy
    Update D2/D2_Copy = C2, D1_Copy = C1

    If D2 != D2_Copy

    Update D2_Copy = D2

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by SharePointGuy Friday, February 8, 2013 7:54 AM
    Friday, February 8, 2013 3:21 AM

All replies

  • Hi,

    I think it is hard to control with SharePoint Designer workflow or other OOB solutions. How about create an event receiver?
    http://blogs.msdn.com/b/pranab/archive/2008/02/28/sharepoint-2007-moss-wss-creating-an-itemupdating-event-handler-as-a-feature-and-packaging-it-in-wsp.aspx

    Thanks & Regards,
    Emir Liu
    TechNet Subscriber Support in forum
    If you have any feedback on our support, please click here.


    Emir Liu
    TechNet Community Support

    Friday, February 8, 2013 2:23 AM
  • My current environment of MOSS 2007 does not allow me to deploy custom solutions. So I guess SPD is the only solution left out for me. If I get some leads on it, would be awesome.

    Friday, February 8, 2013 3:03 AM
  • Hi,

    Could you please share more details about your requirement? Or will the following workflows work for your requirement?

    BaseDate, D1 and D2. C1 and C2 are 2 calculated columns. BaseDate_Copy, D1_Copy, D2_Copy are 3 date columns.

    D1/C1 = BaseDate + 7 days

    D2/C2 = D1 + 14 days

    SharePoint Designer workflow1 (start when new item is created)
    Update D1/C1_Copy = C1, D2/D2_Copy = C2, BaseDate_Copy = BaseDate

    SharePoint Designer workflow2 (start when item is changed)

    If BaseDate != BaseDate_Copy
    Update D1/D1_Copy = C1, D2/D2_Copy = C2, BaseDate_Copy = BaseDate

    If D1 != D1_Copy
    Update D2/D2_Copy = C2, D1_Copy = C1

    If D2 != D2_Copy

    Update D2_Copy = D2

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by SharePointGuy Friday, February 8, 2013 7:54 AM
    Friday, February 8, 2013 3:21 AM
  • This is exactly what I was looking for. Just one more condition is, I was trying to check what if Base_Date, D1 or D2 is blank. We cannot check whether the date column has date or not except I copy the date in a string variable and then check for is not empty. Thanks a ton again.
    Friday, February 8, 2013 4:36 AM
  • Hi,

    In SharePoint 2010, when it is blank in date column, it actually stores the date as "1/1/0001 12:00:00 AM". So we can't check if the date column is blank or not using this condition: if date column is empty. I think it should be similar in SharePoint 2007 and here is the workaround.

    http://social.technet.microsoft.com/forums/en-US/sharepointcustomizationprevious/thread/cd1f9ae5-9edb-4b66-b3fa-8fbdb1dc6cb9

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    Friday, February 8, 2013 5:05 AM
  • I tried to check for this condition. But it does not store any date. I verified for "1/1/1900 12:00:00 AM" too but no luck. When I store the date in a workflow string variable, the is empty condition is true.
    Friday, February 8, 2013 5:31 AM
  • Hi,

    Thanks for your comfirm . And I think this is the difference in SharePoint 2007 and 2010. :)

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    Friday, February 8, 2013 6:14 AM