logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Jareds  
#1 Posted : Friday, June 26, 2015 4:25:05 PM(UTC)
Jareds


Rank: Member

Joined: 6/12/2015(UTC)
Posts: 10
United States

Thanks: 2 times
For compliance with our clients, we need a way to add a ticket number or reason to every client's computer we connect to. Almost all of our work is done on unattended systems.

We need a way to force our users to create a note assigned to the session they join giving a reason as to why they joined.
I found an old post doing exactly what I need, but the code is outdated and doesn't work with the latest version.
http://forum.screenconnect.com/yaf_postst4205_Session-auditing-improvements.aspx#post16744

We have been able to get it to the point where we can get a popup window to come up with a field to enter information, but we are having trouble passing the information to the SessionEvent table.

Does anyone know how we should be going about this or have any suggestions?
Jareds  
#2 Posted : Monday, June 29, 2015 7:25:15 PM(UTC)
Jareds


Rank: Member

Joined: 6/12/2015(UTC)
Posts: 10
United States

Thanks: 2 times
So, after some work we were able to replicate the results from the old code in the host file for the current version (5.3.9074.5646). We still have no idea how to make an extension that might do this, so we will have to update the host.aspx file after every update, making changes where needed.

Another thing, even though the sql table would suggest otherwise, if you use an "EventType" number that isn't being used, (such as 31) the web client gets angry and cannot pull the session info and starts throwing back pipe errors. Our solution to this is to use the "32" event type and remove the ability for people to add or remove notes.

Here is the list of changes from our developer, I am not a programmer so this is all second hand;

Quote:

It starts about line 992, and goes for about 80 lines. Below are just some notes on what the things I changed are

• The joinSession function was already there, and stripped, now containing only a call to another function
• getTicketNumber is a function I created. This is where the prompt pops up. The user has to enter a number, or it tells them to enter a valid ticket number, then throws up the pop up again. After it has a ticket number it logs it through a service call, made by screen connect, and calls connectJoinSession
• connectJoinSession is another function I created. This just contains what was in the joinSession to begin with, starting the actual connection.



Quote:

function joinSession(session) {
GetTicketNumber(session);
return true;
}

//JDL 06/25/2014 This is the new joinSession function
function GetTicketNumber(session) {
var textbox = SC.ui.createTextBox(true, false, null, "Enter a ticket number", SC.res["Command.Join.PlaceholderText"]);

//this is how you get the textbox to show:
SC.dialog.showModalButtonDialog(
'Prompt', //type
'Enter Ticket Number', //title
'Enter', //button text
'Default', //button name(?)
function (container) { //controls shown in the popup
SC.ui.addElement(container, 'P', 'Please enter a ticket number.');
SC.ui.addElement(container, 'P', textbox);
},
function (eventArgs) { //when the button noted above is clicked(in this case "Enter")
SC.dialog.hideModalDialog(); //closes popup box

var data = textbox.value.trim(); //gets the actual textbox entry

if (data === '' || data === 0 || data === null){
SC.dialog.showModalButtonDialog(
'Prompt', 'Invalid Ticket Number', 'Enter', 'Default',
function (container) {
SC.ui.addElement(container, 'P', 'Please enter a valid ticket number.');
},
function (eventArgs) {
SC.dialog.hideModalDialog();
GetTicketNumber();
}
);
}
else {
//Log ticket number in the DB
var allRows = $('detailTable').rows;
var commandRows = Array.prototype.filter.call(allRows, function (r) { return SC.ui.isChecked(r) || SC.ui.isSelected(r); });
var sessions = Array.prototype.map.call(commandRows, function (r) { return r._dataItem; });
var sessionIDs = Array.prototype.map.call(sessions, function (s) { return s.SessionID; });
var sessionInfo = SC.pagedata.get();
var sessionGroupName = (sessionInfo.SessionGroupIndex == -1 ? null : sessionInfo.SessionGroupSummaries[sessionInfo.SessionGroupIndex].Name);
eventType = SC.types.SessionEventType.AddedNote;

SC.service.AddEventToSessions(
sessionGroupName,
sessionIDs,
eventType,
data
);

//Actually join the session
startJoinSession(session);
return true;
}
});
return false;
}

function startJoinSession(session) {
SC.launch.startJoinSession(
session,
function (sessionToken, promptFieldMap, onSuccess, onFailure) {
onSuccess(
SC.util.getClientLaunchParameters(
sessionToken.SessionID,
sessionToken.SessionType,
sessionToken.Name,
null,
sessionToken.AccessToken
)
);
},
false,
null,
null,
null
);
}


I hope this helps anyone else trying to add this functionality to ScreenConnect! I hope that its functionality will eventually be integrated into the program itself.
RPate08  
#3 Posted : Wednesday, January 27, 2016 3:10:17 AM(UTC)
RPate08


Rank: Newbie

Joined: 1/27/2016(UTC)
Posts: 5
United States
Location: North Carolina

Thanks: 1 times
This is PERFECT! We need this really badly. I tried to implement this into Version 5.5.10103.5829 and it causes the Ticket number box to pop up- YAY! - but then wont actually join the session. :(

Any ideas on what could be done to fix this?

I tried to compare the code to the new code myself, but I dont see a difference.

Thanks for sharing this!
Alexander  
#4 Posted : Wednesday, January 27, 2016 5:28:10 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 714
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Looks like it's an issue with handling the new session subgroups; changing
Code:
var sessionGroupName = (sessionInfo.SessionGroupIndex == -1 ? null : sessionInfo.SessionGroupSummaries[sessionInfo.SessionGroupIndex].Name);

to
Code:
var sessionGroupName = sessionInfo.SessionGroupPath[0];

should fix it.
ScreenConnect Team
RPate08  
#5 Posted : Wednesday, January 27, 2016 11:47:25 PM(UTC)
RPate08


Rank: Newbie

Joined: 1/27/2016(UTC)
Posts: 5
United States
Location: North Carolina

Thanks: 1 times
Thank you for your reply!

I made that change and it does allow me to join sessions now, and I see the note with the ticket number i entered added to the notes screen as well as in the audit log.

Now I am wondering how to make the Report Manager extension pull that information and display it in its CSV file.

Any Ideas?

Thank you SO MUCH!
RPate08  
#6 Posted : Thursday, January 28, 2016 12:58:29 AM(UTC)
RPate08


Rank: Newbie

Joined: 1/27/2016(UTC)
Posts: 5
United States
Location: North Carolina

Thanks: 1 times
Do you think there would be a way to make it add the ticket number to one of the custom properties?
Alexander  
#7 Posted : Thursday, January 28, 2016 4:23:43 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 714
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
To set one of the custom properties, just use UpdateSessions instead of AddEventToSessions.

Code:
SC.service.UpdateSessions(
	sessionGroupName,
	sessionIDs,
	sessions.map(function(session) { return session.Name; }),
	sessions.map(function(session) { return session.IsPublic; }),
	sessions.map(function(session) { return session.Code; }),
	sessions.map(function(session) {
		session.CustomPropertyValues[0] = data; // 0 = custom property 1
		return session.CustomPropertyValues;
	})
);
ScreenConnect Team
thanks 1 user thanked Alexander for this useful post.
RPate08 on 1/29/2016(UTC)
RPate08  
#8 Posted : Friday, January 29, 2016 1:29:43 AM(UTC)
RPate08


Rank: Newbie

Joined: 1/27/2016(UTC)
Posts: 5
United States
Location: North Carolina

Thanks: 1 times
Thats exactly what I wanted to do! Thank you so much!

Another question though.. Doing that works great, especially for temporary sessions, the one off Connect/Disconnect stuff. But I noticed that when trying to use that for the permanent sessions it doesn't keep track of each value, or ticket number for each connection to a particular guest- It instead overwrites the old value every time which causes the report to show the same ticket number for every connection to the guest.

Do you have a recommendation for the permanent sessions?

The reason i wanted to use the custom property 2 for this is because I can very easily include that field into my CSV reports from the report manager extension.. I dont see a way to filter out just the ticket numbers from the audit log in that extension.

You have no idea how much this will help us!

Thanks!
Alexander  
#9 Posted : Friday, January 29, 2016 3:33:49 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 714
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Well, so long as you're not using notes for anything else, it seems like you'd want to select Data for EventType = 'AddedNote'.
ScreenConnect Team
RPate08  
#10 Posted : Saturday, January 30, 2016 6:36:09 AM(UTC)
RPate08


Rank: Newbie

Joined: 1/27/2016(UTC)
Posts: 5
United States
Location: North Carolina

Thanks: 1 times
Sweet! That works even better :) the only problem with that is... How could I include the time that a session ended, or the duration? the EventType field isn't available on the report type that allows things like that... That i see anyway.

Thank you Very much!
Alexander  
#11 Posted : Monday, February 1, 2016 6:50:53 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 714
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Hmm, I don't see a way to do that either, but the Report Manager thread would probably be a better place to ask (or request it as a new feature).
[Edit: Actually, I think this is a limitation of the reporting API in 5.5 that the extension is built on top of. So it would be a feature request for that.]

You could potentially add a SessionConnectionEvent instead, with AddEventToSessionConnection(string sessionGroupName, Guid sessionID, Guid connectionID, SessionEventType eventType, string data), but the connectionID isn't available there (since it's before the connection is created), and I think you have to have a valid one for it to work.

Edited by user Tuesday, February 2, 2016 8:18:34 PM(UTC)  | Reason: Not specified

ScreenConnect Team
dhuang6  
#12 Posted : Friday, March 24, 2017 12:49:04 AM(UTC)
dhuang6


Rank: Guest

Joined: 3/2/2017(UTC)
Posts: 4
United States
Location: Madison

anyone have the code to make this work in 6.1?

Thanks
KevinSHI  
#13 Posted : Wednesday, July 19, 2017 6:35:10 PM(UTC)
KevinSHI


Rank: Guest

Joined: 7/19/2017(UTC)
Posts: 2
Canada
Location: Quebec

Was thanked: 1 time(s) in 1 post(s)
I have some code that works for version 6.3
For our organization, we wanted to have the ticket/notes prompt at the end of the remote session. So we have the prompt open "behind" the session, so we can fill it out after we are done. It could probably be move before the session is joined if required

Here is our code in host.aspx :

Code:
			} else if (commandName == 'Join') {
			var buttonText = "Enregistrer";
			var titleText = "Veuiller entrer la raison de votre connection";
			var textBox = SC.ui.createTextBox({size:60}, false, false, SC.res["Command.Join.PlaceholderText"]);
					
					SC.launch.startJoinSession(
						null,
						function (userData, promptFieldMap, onSuccess, onFailure) {
							SC.http.performWithServiceContext(SC.util.doesBrowserNeedSyncServiceContextForLaunch(), function () {
								SC.service.GetAccessToken(
									sessionInfo.SessionGroupPath[0],
									sessions[0].SessionID,
									function (accessTokenString) {
										onSuccess(
											SC.util.getClientLaunchParameters(
												sessions[0].SessionID,
												sessions[0].SessionType,
												sessions[0].Name,

												null,
												accessTokenString
											)
										);
									}
								);
							});
						},
						
						false,
						null,
						null,
						null

					)
					SC.dialog.showModalButtonDialog(
						'Prompt',
						titleText,
						buttonText,
						'Default',
						function (container) {
							SC.ui.addElement(container, 'P', SC.res['Command.Join.Message']);
							SC.ui.addElement(container, 'P', textBox);
											},
						function (eventArgs) {
						SC.dialog.hideModalDialog(); //closes popup box
						var data = textBox.value.trim();
							if (data !== ''){
							window.addEventToSessions(
							window.getSessionGroupUrlPart()[0], 
							SC.types.SessionType.Access,
							[window.getSessionUrlPart()], 
							SC.types.SessionEventType.AddedNote, 
							null,
							data,
							false,
							false,
							true
													);					
											}

											}

					);
					;

Edited by user Wednesday, July 19, 2017 6:37:00 PM(UTC)  | Reason: Not specified

thanks 1 user thanked KevinSHI for this useful post.
p1it on 8/15/2017(UTC)
mreimers  
#14 Posted : Friday, August 11, 2017 9:21:47 PM(UTC)
mreimers


Rank: Guest

Joined: 8/11/2017(UTC)
Posts: 2
United States
Location: Reno

Thanks for the code but do you know if this will work with Screenconnect using Connectwise Automate? I'm pretty sure that it won't as I could not get it to work but perhaps I'm missing something.
p1it  
#15 Posted : Tuesday, August 15, 2017 5:38:14 AM(UTC)
p1it


Rank: Newbie

Joined: 5/25/2015(UTC)
Posts: 3
Australia
Location: Australia

Thanks: 1 times
Is there a way to make this into an extension? I feel like lots of people would use it.
Users browsing this topic
Similar Topics
Unattended Session logging/forced ticket notes code for newer version 6.1 (Advanced Customization)
by dhuang6 3/24/2017 1:09:18 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.