SharePoint 2013 - Workflow Email sent on delayed date

Question!

New to the forums. I'm having a problem initiating a workflow on a specific date. I want to get feedback from our clients when a user gets a new device.

The conditions/actions Ultrabook has been deployed to the end user = Yes Survey Email Sent = Flag to eliminate user receiving more than one email in case row is ever updated in the future. Pause until Survey Distribution Date - This is a calculated field that takes the deployment date and add 14 days to it. Format is date and time Update item in current item updates the Survey Email Sent column to Yes.

I can't seem to get the survey to send when the 14 days are up so that the "Survey Distribution Date" is equal to the current date. I feel like I'm missing something... any help would be greatly appreciated.

Stage:Stage 1

If Current Item:Ultrabook deployed Y/N equals Yes
and Current Item:Survey Email Sent equals No
    Pause until Current Item:Survey Distribution Date
    If Current Item:Survey Distribution Date equals (ignoring time) Today
        Email Current Item:Recipient
        Update item in Current Item

Transition to stage Go to End of Workflow

Screenshot of Designer Workflow Code

By : barnie206


Answers

Pause until only takes the initial value of 'Current Item:Survey Distribution Date' into account. After the deployment date is filled in the value of the Survey Distribution Date will also be updated, but Pause until will not use this value.

You will some sort of a looping functionality. The nicest way to do this is to use 'Transition to Stage' (because it supports multiple conditions) and let it 'loop back' to the beginning of the same stage if all of the conditions are met:

**Stage: WAITING**

Pause for 1 days, 0 hours, 0 minutes
Transition to Stage
If Current Item:Ultrabook deployed Y/N equals Yes
and Current Item:Survey Email Sent equals No
and Current Item:Survey Distribution Date is greater than Today
    Go to SENDING THE EMAIL
Else
    Go to WAITING


**Stage: SENDING THE EMAIL**

Email Current Item:Recipient
Transition to stage
Go to End of Workflow


Sorry I don't get how to put pictures or code into the comments field.... Very confusing...

This is the code I am using. Does this make sense?

Stage:Stage 1
Loop: 1
    The contents of this loop will run repeatedly while: Current Item:Survey Distribution Date is less than 1901-01-13 12:00:00
        Pause until Current Item:Survey Distribution Date
        If Current Item:Survey Distribution Date equals (ignoring time) Today
        and Current Item:Survey Email Sent equals No
        and Current Item:Ultrabook deployed Y/N equals Yes
            Email Current Item:Recipient
            Update item in Current Item

Transition to stage Go to End of Workflow

By : barnie206


I think you could rewrite this as a single query on the status table, using ORs to test each scenario, like so:

SELECT ss.int_tran_id
FROM   status SS
WHERE  ss.stage in ('ACHPayment_Confirmed', 'HIFV4', 'HIFV5_FTRINF', 'Payment_HIFV5_FTRINF')
OR     (ss.stage = 'PREVDAY'
        AND (EXISTS (SELECT NULL
                     FROM   references rf
                     WHERE  ss.int_tran_id = rf.int_tran_id
                     AND    rf.mid_ref IS NOT NULL)
             OR EXISTS (SELECT NULL
                        FROM   app_data ad
                               INNER JOIN ach aa
                                 ON (ad.app_data_id = aa.ach_id)
                        WHERE  ss.int_tran_id = ad.int_tran_id
                        AND    aa.par_number IS NOT NULL)));
By : Boneist


This video can help you solving your question :)
By: admin