Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.
DISCLAIMER
All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.
Cireson does not and will not support or maintain these enhancements, extensions, and scripts.
For Team Cireson uploads click here.
Auto populate Primary Owner field
Hi All,
We would like to auto populate the primary owner field on incidents with the person logging the case. Just wondering if anyone has configured this and if so, how you wen't about it.
I figure it could be done with a custom workflow but this would not be immediately obvious when logging the case. (Would have to close the form etc before it updates).
The approach I am thinking of is to get the sesion.user (if Analyst) and auto fill in the "Primary Owner" field with the name property. This would happen instantly. The only thing I am not sure of is if there is a way I can trigger it only if the IR is new (never been saved). I would not want it to trigger each time the form is accessed by an analyst.
Any thoughts or advice would be apreciated.
Thanks,
Steve
Best Answers
-
Geoff_Ross Cireson Consultant O.G.Hi Steve,
How about you run a task on the Incident form (which will run every time the form loads) that will check if the Primary Owner field is blank and ONLY if it is, then proceed to populate it with the current logged on user?
Geoff5 -
Geoff_Ross Cireson Consultant O.G.Steve, in that case, as my answer above, but also check the URL of the page before setting the Primary Owner.
If it contains '/New/' then proceed, else skip.5 -
Steve_Clarke Customer Adept IT Monkey ✭✭
Ok I have it working now:
====
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
formObj.boundReady(function () {if (window.location.href.indexOf("New") != -1)
{
var po = $('[data-control-bind="RelatesToIncident"]').data("kendoAutoComplete");
var analyst = session.user;
po.dataSource.add(analyst);
po.value(analyst.Name);
po.trigger("change");
}
});
});=====
Thanks @Geoff_Ross for your comments here which helped.
https://community.cireson.com/discussion/594/updating-affected-user-field
9 -
Steve_Clarke Customer Adept IT Monkey ✭✭
Hi Brian,
This solution is for the Cireson portal. In order to implement, just copy the above code into your custom.js file in the inetpub\CiresonPortal\CustomSpace folder.
Regards,
Steve
0
Answers
How about you run a task on the Incident form (which will run every time the form loads) that will check if the Primary Owner field is blank and ONLY if it is, then proceed to populate it with the current logged on user?
Geoff
Is your end goal to see the Created By for your Incidents? If it is, just add the Created By property to the IR form and disable it so it cannot be changed. The relationship is tracked, just not displayed by default on the Console or Portal forms.
Thanks for your thoughts everyone.
We just want the behaviour that if an Analyst logs a case, they automatically take ownership of that case and become the primary owner (they may also become the assigned to).
Geoff I have been thinking along the lines of what you suggested. The only thing with only checking if the field is blank is that if the system auto logs the case (end user sends an email to monitored mailbox), the first person to open the case will be set as the primary owner. I guess this may not be desirable if someone is just opening the case to check if it is relevent to them when it is auto logged.
Can anyone think of a way to trigger a task only if the incident has not been created yet? Maybe there is some property that is null until the form is saved?
That way I could do the following:
1. If an Analyst opens a new Incident form (unsaved). Set that Analyst as the Primary Owner as they are logging a new case and should initially take ownership of it.
2. If a case is auto logged by system (client sends email to monitored mailbox), it gets logged without a primary owner. If an analyst opens this IR form (that is already saved) it does not put them into the Primary Owner field.
Damon, the created by would be an option but that would have to happen after the form has been saved (you would need to close the form and re-open it to see the field populated. I would also have to exclude the workflow account for when the case is autologged by the system (this is probably not a problem and easily do-able)
Adam, I did think abou the runbook approach but I am not keen the delay involved with this approach.
Appreciate all the input guys.
Steve
If it contains '/New/' then proceed, else skip.
Ah nice, didn't notice new in the URL. I'll try come up with something today. Thanks
Ok so I ALMOST have it working.
Please note that I am not a java scripter so if you can see any issues/improvements please let me know
Here is the code:
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
formObj.boundReady(function () {
if (window.location.href.indexOf("New") != -1)
{
var po = $('[data-control-bind="RelatesToIncident"]').data("kendoAutoComplete")
var analyst = session.user
po.value(analyst.Name)
}
});
});
The field now gets filled in but the little information (i) icon does not appear to the left of the name. Also if you save the form it doens't 'stick'
Ok I have it working now:
====
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
formObj.boundReady(function () {
if (window.location.href.indexOf("New") != -1)
{
var po = $('[data-control-bind="RelatesToIncident"]').data("kendoAutoComplete");
var analyst = session.user;
po.dataSource.add(analyst);
po.value(analyst.Name);
po.trigger("change");
}
});
});
=====
Thanks @Geoff_Ross for your comments here which helped.
https://community.cireson.com/discussion/594/updating-affected-user-field
Works great!
Thanks Steve!
Cireson support referred me to this post so it must be the accepted answer.
Are you creating a new Task under the library in the SCSM Console and entering this code in the Command Line section?
If so, what is the "Full Path to Command"?
Hi Brian,
This solution is for the Cireson portal. In order to implement, just copy the above code into your custom.js file in the inetpub\CiresonPortal\CustomSpace folder.
Regards,
Steve
Ahhh...the custom.js.
Thanks! Works perfectly.