how to set a time delay to populate widget on portal

asha23
Tera Contributor

I have created a widget called "Action"  which contains  2 buttons on the request table.  when the user submits the request ticket I want to show the widget with 20 seconds of time delay. 
How to do that?

6 REPLIES 6

Sai Kumar B
Mega Sage
Mega Sage

Hi

you can use setTimeOut() to display widget after a certain time

HTML

<sp-widget widget="c.Widget"></sp-widget>

CLIENT SCRIPT

function(spUtil) { //Submit function
    var c = this;
setTimeout(function(){
    spUtil.get("widget ID").then(function(response) {
            c.Widget = response;
    });
},20000); 
}

Best regards,
Sai Kumar

 

Sai Kumar B
Mega Sage
Mega Sage

@asha 

Did you get a chance to review this?

Best regards,
Sai Kumar

Thank you for you response  sai kumar, it works . 

@asha  I'm glad it worked can you please mark my answer as correct, so it would help others as well.

Best regards,
Sai Kumar