Find your content:

Search form

You are here

Setting a function to run at set intervals in a Landing Page in SSJS

 
Share

I would like to run the following HTTP.GET function at a set interval (every 1 minute) until 10 minutes have passed or it has succeeded in retrieving the content.

var contentRetriever = function(){
for (var x = 1; x <= 10; x++){
        try {   
            data = HTTP.Get(feedurl);
            Variable.SetValue('RSSDATA', data.Content);
            RSSdebugDE.Rows.Add({FEED_NAME:feed,STATUS:"OK",MESSAGE:feed + ": content retrieved after " + x + " try"});
            x = 10;
        }
        catch(e){
            success = false;    
            }
        }
    if (success == false){
        RSSdebugDE.Rows.Add({FEED_NAME:feed,STATUS:"Error",MESSAGE:feed + ": content could not be retrieved after " + x + " retries"});
    }
};

I've tried using the setInterval and setTimeout functions for JS, but this only seems to apply for front end javascript?

Is it possible to use these functions in SSJS in ExactTarget? And if so, how it would work?

Thanks!


Attribution to: Christopher Carswell

Possible Suggestion/Solution #1

In order to do this, you would want to build a "middle-tier" page that does the http.get call and returns data, and then on the client side run the interval.

Think of SSJS as any other server side scripting language. Once it runs, it won't run again until it's called by the server.


Attribution to: Kelly J Andrews

Possible Suggestion/Solution #2

There is a way to do this now with Script Activities in Automation Studio. SMFC support can enable them for you.

Once enabled, you can define a Script Activity in Email -> Interactions and then schedule it in Automation Studio to run on an interval.


Attribution to: Adam Spriggs
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30060

My Block Status

My Block Content