Custom Workflow Notification Email
I want to be able to send custom emails when a page is updated for approval. I saw the following line in PagesApprovalWorkflow.xamlx:
<
tswa:NotifyGroup
EmailText
=
"You have new items waiting approval."
Group
=
"Approve"
sap:VirtualizedContainerService.HintSize
=
"292,173"
/>
Hello,
You should modify the workflow templates. Inside the template you should customize NotifyStateChanger EmailText. Then you have to map customized templates through Sitefinity/Administration/Settings/Advanced >> Workflows. We use Windows Workflow Foundation and you will be able to modify the template in Visual Studio or another text editor. If you inherit from NotifyGroup you can get the item id and decide what message to put in your email template
public class NotificationActivityBaseCustom : NotifyGroup
public override List<string> GetEmails(System.Activities.CodeActivityContext context)
var emails = new List<string>();
var dataContext = context.DataContext;
var workflowDefinition = (WorkflowDefinition)dataContext.GetProperties()["workflowDefinition"].GetValue(dataContext);
var d= (((Telerik.Sitefinity.Fluent.AnyContent.Implementation.AnyDraftFacade)((dataContext.GetProperties()["masterFluent"].GetValue(dataContext)))));
var originalID = d.Get().Id;
return emails;
Greetings,
Ivan Dimitrov
the Telerik team
Ivan,
Where would those templates be located? Somewhere in the SitefinityWebApp project I am assuming? (Only started using Sitefinity last week, so I'm still finding my way around.)
We do have a custom workflow we are doing this for if that makes any difference.
Thanks,
Chris
In addition to Chris's request for the workflow templates has there been a release of all the templates?
I'm constantly having to search for an individual template or ask & wait for it to be released on the forum. Why not add a download for all of the templates? If I recall correctly, this was done with Sitefinity 3.
Hello,
The templates should be available in the SDK installation package.
All the best,
Ivan Dimitrov
the Telerik team
Ivan,
There's no place inside a SitefinityWebApp Visual Studio project where I can get to them? If not, it makes it rather tricky for me...
Thanks,
Chris
Hi,
I have attached the workflows used by Sitefinity. Here is also a blog post that describes the workflow customization process.
Kind regards,When loading the workflows in VS, there seem to be elements missing, and I am unable to look at everything I need.
This workflow is PagesApprovalWorkflow.xamlx that was located in my SitefinityWebApp directory. Please see attached screenshot. Any ideas?
Thanks,
Chris
Hello,
This is strange it is showing all workflow activities at my end. Is the visual studio installation full with all features?
Regards,As far as I remember, yes, but I can double check. Is the workflow stuff optional?
VS 2010 Professional Edition with Service Pack 1 if that helps.
Thanks,
Chris
I think I about have this.
One weird behavior I was noticing: when I attempted to create a new VirtualPath, I was getting FileNotFound exceptions. When I changed it back to the default, though, I would also get FileNotFound exceptions. I solved this by just changing the default virtual path (~/DefaultWorkflows/PagesApprovalWorkflow.xalmx) to point to the correct file in my assembly rather than the Telerik default. Still, rather weird behavior that I thought I should point out.
Thanks,
Chris Aumiller
Hello,
I suppose the problem with file not found exception was caused by improper configuration change as when trying to save a path to the workflow there is no regular expression check if the path contains a file with .xamlx extension (also I tried to change the default workflow paths with correct and incorrect paths) .
Are you able to create .xamlx project and view the .xamlx file at your end. I am not sure if I suggest something of help as the .xamlx file is read only and sitefinity doesn`t provide and logic to aid in rendering it in visual studio.
For this -
default virtual path (~/DefaultWorkflows/PagesApprovalWorkflow.xalmx) to point to the correct file in my assembly
- What did that look like in the settings?
Hello,
The virtual path to the embedded workflow for pages located in Telerik.Sitefintiy.Workflow.Workflows.PagesApprovalWorkflow.xamlx is accessible trough settings in (here is a screenshot). I am not sure if I understood the question correctly so please explain again if this is not what you meant.
Regards,
Stanislav Velikov
Telerik