Custom Task to assign SR to specific AD Group
Hey Guys
I Need a custom Task, to assign the SR to a specific AD Group.
Does anybody of you know how to call viewModel.AssignedWorkItem.set() ?
Which Parameters i Need to add?
Please see the full Code of my Task.
//New Task => SR assign Request HRLMS
app.custom.formTasks.add('ServiceRequest', "set completed", function (formObj, viewModel) {
$.when(kendo.ui.ExtYesNoDialog.show({
title: "Assign Service Request to HRLMS",
message: "Are you sure you want to assign this Service Request to HRLMS?"
})
).done(function (response) {
if (response.button === "yes") {
//set new assign
AssignedWorkItem.set() //Here is the Code missing
formObj.save(function (data) {
//save success message
app.lib.message.add(localization.ChangesApplied, "success");
//reload page
location.href = "/ServiceRequest/Edit/" + viewModel.Id + "/";
}, function (exceptionMessage) {
//generic error message
app.lib.message.add(localization.PleaseCorrectErrors, "danger");
app.lib.message.show();
});
if(history.length > 1) { history.back() } else { window.location.href = 'https://portal.contoso.com/View/cca5abda-6803-4833-accd-d59a43e2d2cf' }
}
});
return;
});
Best Answer
-
Kevin_Baier Customer IT Monkey ✭
Okey found it by myself
app.custom.formTasks.add('ServiceRequest', "Forward to HRLMS",
function(formObj, viewModel) {
$.when(kendo.ui.ExtYesNoDialog.show({
title: "Assign Service Request to HRLMS",
message: "Are you sure you want to assign this Service Request to HRLMS?"
})).done(function(response) {
if (response.button === "yes") {
//set new assign
viewModel.AssignedWorkItem.BaseId = '708915cf-cfb5-7b0b-20d0-519aa5959730';
viewModel.AssignedWorkItem.DisplayName = 'CONTOSO\\.LIS-HRLMS-Helpdesk-HRLMS';
viewModel.AssignedWorkItem.set("AssignedWorkItem", {
BaseId: '708915cf-cfb5-7b0b-20d0-519aa5959730',
DisplayName: 'CONTOSO\\.LIS-HRLMS-Helpdesk-HRLMS'
});
}
});
return;
});BaseId = UserID/Group-ID in ServiceManagement Database
DisplayName = Displayname with Domain from AD Group
5
Answers
Okey found it by myself
app.custom.formTasks.add('ServiceRequest', "Forward to HRLMS",
function(formObj, viewModel) {
$.when(kendo.ui.ExtYesNoDialog.show({
title: "Assign Service Request to HRLMS",
message: "Are you sure you want to assign this Service Request to HRLMS?"
})).done(function(response) {
if (response.button === "yes") {
//set new assign
viewModel.AssignedWorkItem.BaseId = '708915cf-cfb5-7b0b-20d0-519aa5959730';
viewModel.AssignedWorkItem.DisplayName = 'CONTOSO\\.LIS-HRLMS-Helpdesk-HRLMS';
viewModel.AssignedWorkItem.set("AssignedWorkItem", {
BaseId: '708915cf-cfb5-7b0b-20d0-519aa5959730',
DisplayName: 'CONTOSO\\.LIS-HRLMS-Helpdesk-HRLMS'
});
}
});
return;
});
BaseId = UserID/Group-ID in ServiceManagement Database
DisplayName = Displayname with Domain from AD Group