Programmatic use of workflow with notification
I am working on a project with many data types created with the Module Builder.
I have a workflow enabled which generates emails when using the Sitefinity backend.
Now I am trying to use the workflow and notifications from buttons on the frontend.
I've been using IApprovalWorkflow.SetWorkflowStatus to change to "AwaitingApproval" etc. and then dynamicModuleBuilder.SaveChanges(). That was fine, but I also need to generate emails for Submit, Approve and Reject.
I found this:
and tried to add the "Send Item for Approval" to my code, but an email is not generated and there are no exceptions.
Does anyone have a sample of doing this with Module Builder data?
thanks in advance,
I believe this could easiest achieved using custom workflow and there is a sample to what I believe you are trying to achieve here: Implement custom workflow activity
Hope this helps.
Thank you, Vassil. I have seen the information you posted, however I have two needs.
1) I cannot get the default workflow to run from my code.
2) I will also want to modify the content of the email, so that the notes about the state change are in the email.
Please see the code I am using for the custom submit button. Notes are normally saved for Rejected items only, but I am saving a note for Awaiting Approval, Rejected and Published. My "UnitEditable" field is controlling the ability to modify drafts on many other content types which act as multiple children to the one for which I am trying to create notifications.
The lines which are commented were not working for module builder data.
Thank you, Scott