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.



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

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.

/// 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);

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)

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

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)
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.