logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
JellyKid  
#1 Posted : Wednesday, May 18, 2016 4:30:19 PM(UTC)
JellyKid


Rank: Guest

Joined: 5/18/2016(UTC)
Posts: 4
United States
Location: Detroit

Was thanked: 1 time(s) in 1 post(s)
It's taken me a little while but I've finally figured out some of the SC api internals for things that are not documented. I'm writing an extension that runs a specific command on a host that then retrieves the output for that command. Is there any kind of promise/callback for SC.service.AddEventToSession() so that I can tell when a command has finished? I see that it accepts functions onSuccess and onFail but I'm not 100% sure how/why they are being called.


Quote:
SC.service.AddEventToSessions(
window.getSessionGroupUrlPart()[0],
sessionIDs,
SC.types.SessionEventType.QueuedCommand,
unblockCommand,
function(success){
/// This is where I would like to call the following after the command has been completed
sortedEvents = SC.util.getCacheEntry(sessions[0].SessionID + 'SortedEvents', sessions[0].LastAlteredVersion);
},
function(fail){
console.error(fail);
}
);


Or if not a promise/cb is there an event I can listen for on command completion?
thanks 1 user thanked JellyKid for this useful post.
AustinKnight on 5/19/2016(UTC)

Scott  
#2 Posted : Monday, May 23, 2016 6:14:55 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,862
United States

Thanks: 3 times
Was thanked: 351 time(s) in 303 post(s)
Quote:
Or if not a promise/cb is there an event I can listen for on command completion?


Not exactly, but sort of. You can watch the list of RanCommands in the session's connectionevent history, pull the latest entry, and do a bit of parsing to figure out if it's an entry you care about. Take a look at the engine behind the Remote System Diagnostics extension, it basically wraps it's commands into a HTTP-like object to make parsing easier.
ScreenConnect Team
Users browsing this topic
Similar Topics
Rest API questions (General Information)
by DCIArtformDev 9/12/2018 8:22:15 PM(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.