Abschlussmail in Journal aufnehmen

Post Reply
TaWu
Posts: 15
Joined: 05. May 2022, 16:34
Contact:

Abschlussmail in Journal aufnehmen

Post by TaWu » 09. May 2022, 14:17

Guten Tag,

gibt es eine Möglichkeit die Mail, die über den Schließen-Dialog an den/die User geschickt werden kann ("Ihr Ticket wurde geschlossen"), ins Journal zu übernehmen? Es geht darum, dass man im Journal sieht, an wen alles diese Mail versendet wurde, z.B. wenn man im Schließen-Dialog noch weitere User hinzugefügt hat, die informiert werden sollen.

Vielen Dank.
Viele Grüße,
TaWu
Last edited by TaWu on 16. May 2022, 10:24, edited 1 time in total.

Steinbit
Posts: 128
Joined: 30. Nov 2017, 16:32
Contact:

Re: Schließenmail in Journal aufnehmen

Post by Steinbit » 10. May 2022, 14:14

Hi,

I didnt find a solution to copy the sent mail to the journal as there is no - or unknown - reference from the stored emails (SPSEmailClassBase) to the Ticket (SPSActivityClassBase), however I elaborated a solution how you could track the selected users when added as further recipients. The final solution could look this:

Other fields could be tracked and/or added.Image

To do this I used the mx.Data.Fragments and mx.Data.Objects function to update the journal of all selected tickets during the save process.
Attachments
2022-05-10 14_11_25-Activities __ Testsystem.png
(21.81 KiB) Downloaded 530 times

TaWu
Posts: 15
Joined: 05. May 2022, 16:34
Contact:

Re: Schließenmail in Journal aufnehmen

Post by TaWu » 11. May 2022, 09:34

Hi,

this solution you came up with would be totally fine for us, but I am not so much into configuration M42 yet, so I don't know from your post what I exactly have to do. Is there a possibility to get an more detailed instruction on what I have to configure from you?

Thank you.

Steinbit
Posts: 128
Joined: 30. Nov 2017, 16:32
Contact:

Re: Schließenmail in Journal aufnehmen

Post by Steinbit » 12. May 2022, 16:27

You can achieve the result by performing the following steps:
  • Adding a new Journal entry type: Administration > Schema > DataDefinition > SPSJournalEntryPickupType > Data > Add new line:
Value: 20001
DisplayString: Users informed
Header Template: {journalCopiedFromTicket}{journalCopiedTicketId}Further users informed by {journalCreator}
Body Template: Following additional users have been informed: {users}
  • ChangeWizard for Closing (z.B. Incident / Service Requests): Administration User Interface > Layouts > Wizards > Close Ticket - either you change the standard wizard or create a copy first > Change Layout
  • Add property to Data Model "SubmitData > AddJournal (Type: String)":
Advanced mode:
Related data model properties and localizable resources:
sourceState [Watchable: Yes] SubmitData.$sourceState
informFurtherUsers [Watchable: No] SubmitData.data.InformFurtherUsers
objectIds [Watchable: No] SubmitData.data.ObjectIds
currentUser [Watchable: No] Context.CurrentUser

Expression (Javascript):

if (sourceState.$value == 2 && informFurtherUsers.$value != "") { // Wizard on Finished State (only when Closure performed and InformFurtherUser not empty
setTimeout(function() {

// Get information for selected tickets, such as Ids, or TypeName
mx.Data.Fragments.getList("SPSActivityClassBase?where=[Expression-ObjectID] in ('"+objectIds.$value.join("','")+"')&columns=T(SPSCommonClassBase).TypeID AS TypeID, ID AS ID, [Expression-ObjectID] AS ObjectID, SUBQUERY(BasicSchemaObjectType AS sot, sot.Name, sot.ID = base.T(SPSCommonClassBase).TypeID) AS [TypeName]").then(function(data){
return data;
}).then(function(data1){

// When results returned, loop through each item and update the Journal (SPSActivityClassUnitOfWork)
data1.forEach(function(obj) {

mx.Data.Objects.get(obj.TypeName, obj.ObjectID, 1).then(function(data2){

var str = informFurtherUsers.$value.join("</fragmentId>\r\n <fragmentId>");

// Add new Journal item to existing object array
data2.SPSActivityClassUnitOfWork.push(
{
"TypeID": obj.TypeID,
"OriginalSolutionHtml": "",
"SolutionParams": "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<parameters xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <JournalEntryParameterBase xsi:type=\"JournalEntryDataObjectParameter\" name=\"users\" dataDefinition=\"7c9df8f2-d564-47ca-8fd9-92fcbed7b58b\">\r\n <IsPortalMode>false</IsPortalMode>\r\n <IsExportMode>false</IsExportMode>\r\n <FragmentIds>\r\n <fragmentId>" + str + "</fragmentId>\r\n </FragmentIds>\r\n </JournalEntryParameterBase>\r\n</parameters>",
"ActivityAction": 20001, // Match with value of new JournalEntryType
"Creator": currentUser.$value,
"VisibleInPortal": 0,
"CreatedDate": (new Date()).toISOString()
}
);

data2.SPSActivityClassUnitOfWork.map(function(item) {
delete item.UsedInType; // UsedInType must be removed before update
return item;
});

mx.Data.Objects.update(obj.TypeName, JSON.stringify(data2), 1);

});

});
});
}, 300); // Sleep for 300 milliseconds to prevent conflict with saving process
}

return $value;

TaWu
Posts: 15
Joined: 05. May 2022, 16:34
Contact:

Re: Schließenmail in Journal aufnehmen

Post by TaWu » 13. May 2022, 14:21

Hi,

thank you very much. I configured everything as you described and it works perfectly for admin users. But standard users now get the error message each time they close a ticket that they are not allowed to execute the webservice operation.

I checked the audience for the web service operation type ticket.close and it is set to unrestricted. Where else do I have to set the audience right or should it work without it and something else is still wrong?

Thanks for your help!

Steinbit
Posts: 128
Joined: 30. Nov 2017, 16:32
Contact:

Re: Schließenmail in Journal aufnehmen

Post by Steinbit » 13. May 2022, 20:39

Hi,

as I'm using the mx.Data.Fragments and mx.Data.Objects functions, you will need to set the permissions accordingly. To do so, please change to administration > Integration > Web Services > Public API.

Depending on your security level you might want to unrestrict the access to the following APIs: Fragments.GetList, Objects.GetObject and Objects.UpdateObject. You can do this by selecting them and click on the action "Set audience". If you want to be more cautions, grant these permissions based on role, OU or to single users.

Thomas

TaWu
Posts: 15
Joined: 05. May 2022, 16:34
Contact:

Re: Abschlussmail in Journal aufnehmen

Post by TaWu » 16. May 2022, 13:39

Hi,

hat super funktioniert. Vielen Dank :D !

VG

Post Reply

Return to “Service Desk”

Who is online

Users browsing this forum: No registered users and 9 guests