Custom Workflow on Dynamic Content Items
I have 13 dynamic Modules in which I am attempting to set up workflows for. I am having an issue getting data from the workflow item. One example of my Dynamic Module is "LandingPageTabs". I have the following code:
var dataContext = context.DataContext;
var item = dataContext.GetProperties()["workflowItem"];
var module = item.GetValue(dataContext) as AnyDraftFacade;
The item is getting returned as null and I am uncertain as to why. When I debug the item, I can see all the properties, but they are ALL listed as null I have created workflows for Pages and get data (ID, Title, AvailableCultures, etc.) from the workflow item. What am I doing incorrectly to not get any data?
I have also done the following (found from other blog posts) and get everything to be null:
var masterFluent = dataContext.GetProperties()["masterFluent"].GetValue(dataContext) as AnyDraftFacade;
var fluent = dataContext.GetProperties()["fluent"].GetValue(dataContext) as IAnyDraftFacade;
I have been using the following blog posts as reference:
www.sitefinity.com/.../custom-workflow
www.sitefinity.com/.../how_to_customize_sitefinity_workflow_notifications
www.sitefinity.com/.../workflow---feedaback-while-approving-the-content
The site I am working on is multilingual with 13 different languages. What I am in need of is when the English version is "approved", the workflow will send an email to all the editors in the other language. Then, when all items are "Awaiting Publishing", the users in Publisher Role get an email to publish all items. I do have this working for Pages, but the logic does not appear to be the same for Content Items. Any help on what I possibly could be doing wrong would be greatly appreciated.
Hello,
The item that is passing trough workflow is retreived with the property masterFluent from the workflow context.
var dataContext = context.DataContext;
var masterFluent = dataContext.GetProperties()[
"masterFluent"
].GetValue(dataContext)
as
MasterFacade;
The item can be retrieved from the workflow by the id of the item tough all modules created with the module builder are using this workflow so check the type of module which is passing trough workflow and if the module is the correct type get the item ID to work with the item:
var dataContext = context.DataContext;
var masterFluent = dataContext.GetProperties()[
"masterFluent"
].GetValue(dataContext)
as
MasterFacade;
//check the type of the module
var moduletype = masterFluent.Get().GetType().FullName;
if
(moduletype ==
"Telerik.Sitefinity.DynamicTypes.Model.Schools.School"
)
//get the id of the item passing trough workflow
var itemId = masterFluent.Get().Id;
if
(moduletype ==
"Telerik.Sitefinity.DynamicTypes.Model.Schools.Teacher"
)
//another logic