function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
galigali 

limits to what i should do in an scontrol

hello.

i've had several requests lately for scontrols which do queries and updates to many objects. for example, i query all open opportunities, iterate and query their products, do some product line item calculations, then update the individual opportunities.

when these apps were first proposed to me, i suggested writing each as a standalone app that is set to run at an appropriate interval. i'm concerned with browser time-out, etc, as these scontrols take some time to run. however the people that propose the work would rather avoid the task of deploying and configuring the code...

so i'm looking for other opinions. how do you typically handle these requests. should i just set up my own (hosted) machine where i deploy all of these apps so that the clients don't have to worry about them? (plus i'll always have access to the code in case updates are required.) or - what is the limit of what you'll do in an scontrol (i know there is no concrete answer for this.)

thanks for your time
Ron HessRon Hess
I run several of these type of jobs on a standalone box where I can monitor the log files generated by the scripts and catch the timeouts (and retry) .

If you have many opportunities, then walking them from a scontrol does not seem like a good idea. What if the user closes the scontrol window while it's in the middle of the process? etc...
ksparkspar
scontrols are a great front-end to web apps, like the ones we write in Java.
I'm finding that I can take advantage of scontrols to double check that all
the required fields in a form are completed before I launch the web app (all
though it's not always easy to do, as in finding opportunity fields resulting
from a lead conversion).

That means I can write thinner web apps that are easier to structure
for performing error handling (and support easier to manage OO applications).
And, as Ron says, you can get extra metrics for logging and such.

scontrols are also nice for writing simple "status applications" as alternative
to reports. Reports are cool, but sometimes there are requirements that
execs or other managers have that require custom presentations that html and
css handle well... i.e., they don't want to wade through excel or lots of
scrolling html. I'm sure that dashboards can do the same thing, but I need
more experience with them.

All in all, I find that my favorite use of scontrols is to offload the
front-end chores so I can focus on pretty powerful web applications for
integration with salesforce. The Ajax stuff is great as a way to simplify
the nightmare javascripts I've seen... but again, I like the heavy lifting
in an environment I can control.

I've only been doing this stuff for a few months, so hopefully my ignorance
isn't showing through too badly ;}

David
DevAngelDevAngel

Hi gali,

This is a great question. 

S-Controls are very powerful.  With the advent of the AJAX toolkit they are now much easier to support and hopefully, as the toolkit approaches version 1.0, more robust and predictable as well.

Having said that, they are most effective when used to solve the right problem.  An scontrol is best used to provide more process control and extended functionality when applied to a user-centric proccess.  In other words, they should be used to help the end user complete a task efficiently.  The key part of the statement is the implied interaction with a user, which precludes unattended operations. 

An S-Control that does not use ActiveX or signed applets will be restricted in ways that make it innappropriate or difficult to implement for certain processes.  Any process that needs to make a call out to a web service (apart from the sforce API) will require reduced browser security to allow that call.  If the scontrol want's to access an internal system (db, erp etc) it will also require some security gymnastics.

You could, on the other hand, create S-Control-like scripts that can run on a customer's desktop outside of the salesforce.com application to do the kind of integration that you are attempting.  These would run in the context of a web page on a user file system.  There are security issues here as well, but have different implications since they are local pages that are running.  By running in a local page served up by the file system, you can avoid the requirement that the user not "tab" away from a running process. 

Using the AJAX toolkit with well thought out batch sizes and asynchronouse techniques should allow for the granularity of feedback required to do logging (how about logging the data to a custom object in salesforce) and recovery.

In determining when to use an S-Control, you need to ask whether or not there needs to be a UI and user interaction and if the process is part of some other user-based process.  Polling is not a good application of S-Controls.

If I've not been clear, please let me know and I will elaborate further.

 

Cheers