Now, the idea behind this is very simple. I want to have an Engagement plan with a certain Condition and a State and I want to have a custom Save Action between them which will have couple of fields. Fairly simple, right?
So let’s start!
First I am going to define custom Save Action under
/sitecore/system/Settings/Analytics/Engagement Automation/Predefined items/Actions
which will look something like this
In Type string, the first parameter is the C# code of the action itself, followed by the DLL in which the code is.
In Editor is the path to the xml file which presents the dialog (name contains namespace + name of the class + name of the xml file).
Now I can create a test Engagement plan.
Next step is to create a backend code which will support newly created Save Action. Time for the fun part!
I couldn’t find online any available example or documentation about this, so the solution was to decompile .dll files which are used for these save actions (it took quite some time to find them) which are:
Each dialog has 3 parts (as shown on the Save Action image above)
- xml dialog
- The action code
- The editor code
The dialog is placed on the following path:
This is the example of dialog with 2 fields in it:
NOTE: Do not forget to save your file as xaml.xml otherwise you will get that aspx page cannot be found!!!
The action code
The editor code
Time to test the Save Action after building and deploying the code.
And this is how the dialog looks when you press the Edit:
Now you can already start a debugger, the parameters are picked and saved, you just need to decide what do you want to do with this and place your business logic.
That’s all folks, happy coding!
And last but not least, a very big thank you to Mike Reynolds who survived Skype screen share session and all the WTF moments during the early morning hours 🙂