Creating Custom Tasks
I'm having some issues with creating custom tasks on incident requests. I've following kb article here: https://support.cireson.com/KnowledgeBase/View/52#/. When I launch my test portal and create a new incident the new task never shows up. I've cleared the custom.js file of all other code but this isn't working for me.
here is my code which is taken directly from the KB article.
thanks in advance.
/*test scripts */
<div>app.custom.formTasks.add('Incident', "Resolve", function (formObj, viewModel) </div><div>{ $.when(kendo.ui.ExtYesNoDialog.show({ title: "Change Status", message: "Are you sure you want to change the status to resolved?" })).done(function (response) </div><div>{ if (response.button === "yes") { set new status viewModel.Status.set("Name", "Resolved"); viewModel.Status.set("Id", "b6679968-e84e-96fa-1fec-8cd4ab39c3de"); </div><div>} }); return; });</div>
Best Answer
-
john_doyle Cireson Support Ninja IT Monkey ✭✭✭✭There is an unmarked comment in the middle of your code. Try this:
app.custom.formTasks.add('Incident', "Resolve", function (formObj, viewModel) { <br> $.when(kendo.ui.ExtYesNoDialog.show({ title: "Change Status", message: "Are you sure you want to change the status to resolved?" })).done(function (response) { if (response.button === "yes") { <br> /* set new status */ <br> viewModel.Status.set("Name", "Resolved"); <br> viewModel.Status.set("Id", "b6679968-e84e-96fa-1fec-8cd4ab39c3de"); } });<br> return; });
5
Answers
The button example on the Cireson page - https://support.cireson.com/KnowledgeBase/View/51#/ doesn't work (as an example). Or I can't get it to work.
How can I get the outcome above (change status) to work with a button within a customised incident form.
Yes, this is possible, what trouble did you have following the guide in the article?
Geoff
Thank you for replying, appreciate it.
I've followed the guide, created a customised form for a specific AD group, set the assign group to the form. Form is visible only to that group.
As a test from the KB article, I've add the button code to the form
app.custom.formTasks.add('Incident', null, function(formObj, viewModel){ viewModel.set("Demo", function() { alert("hi"); }); });
added to the custom.js file: ( use script loader method)
{DataType: "Button", PropertyDisplayName: "Click Me!", ButtonType: "default", Action:"Demo"}
Updated the cireson cache (several times) doesn't work.
In a real scenario, I wanted to achieve the same as this, but with a button within the form. I wasn't sure how to call the action from the button code-- what the action name was or if this code was right.
I understand what the code is doing, but I don't have the knowledge to re-write the code to work with a button.
Thanks, any help would be appreciated.