• Adam Tolbert
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies
Hey Dev Community!

Im currently working on a Custom Lightning Component and there are a few edge cases that I'm trying to account for. This lightning component makes a few API calls and therefore, may take some time to complete. I need a way to determine if the user bailed mid stream and I can do this easily with a 'Cancel' button with an onclick event that does some logic before calling $A.get("e.force:closeQuickAction").fire();

However, if the user bails with the 'X' in the top right hand corner the API calls cease and I cannot figure out how to handle this. The two ways I have theorized are either react the same way as the button, or make the button the only option but I dont know if I can react to the 'X' click nor if I can hide the 'X' with CSS or some equivalent. 

Any advice would be appreciated!! 
Can someone please explain to me why the following code doesnt execute on its own?? It will only run one time and then requires a touch interaction on the screen to continue to run. Code works as expected if you rapidly click the screen, but hangs itself if the user doesnt click the page.
 
testFunction : function(component, token, tempSo) {
        var action = component.get("c.forLoopTest");
        
        action.setParams({
            "I": 5
        })
        console.log("I ran")
            action.setCallback(this, function(res) {
            

                console.log("Callback ran")
                console.log(res.getReturnValue())
                if(res.getReturnValue() < 20) {
                    setTimeout(() => {
                        console.log(res.getReturnValue());
                        action.setParams({
                            "I": (res.getReturnValue() + 1)
                        })
                        $A.enqueueAction(action)
  
                    }, 500)
                } else {
                    console.log("You did it!")
                }
        

        })
        $A.enqueueAction(action)

    },
 
Apex Controller class  

@AuraEnabled
    public static Integer forLoopTest(Integer I){
        Integer newI = I;
        return newI;
    }

 
Alright community, Im in a real pickle here and hoping someone can shed some light on what I'm doing wrong, and/or what I can do to work around this particular problem.

I have a Custom lightning component that is calling out to a third party API over multiple synchronous steps and I need to call out to the same API multiple times over a period of 10-30 seconds in order to determine as soon as is reasonable, when that API response changes from Still Processing, to Finished Processing. 

I am currently doing this as follows:
 
var seventhAction = component.get("c.APICall");
seventhAction.setParams({
 "body": GetSalesOrderBody,
 "task": "GetSalesOrderDetails"
})
seventhAction.setCallback(this, function(res) {
 if(res.getReturnValue().includes("InProcess")) {
 console.log("Still Processing Order")
 setTimeout(() => {
    $A.enqueueAction(seventhAction)
 }, 2000)
} else {
console.log(res.getReturnValue())
console.log('Congrats! This API has finished processing and has returned a new order id
of ' + res.getReturnValue().Id + '');
}


And this function will not recursively call itself... It will just hang there with a console.log() of "Still Processing Order" for up to 5 minutes... However when I click, anywhere on the screen, the task will run as expected. This should not require any user input after it has been fired and I cannot ask my users to just click the screen a ton until the screen goes away. What am i missing here??

Sidenote:
If I run this function without a set timeout, I will execute about 10 times in rapid succession before it hangs itself and awaits click input to get it back on track. I have exhausted my personal supply of potential hacks around/reasons for this problem and am coming up short. Prize goes to the bext answer! 
Alright community, Im in a real pickle here and hoping someone can shed some light on what I'm doing wrong, and/or what I can do to work around this particular problem.

I have a Custom lightning component that is calling out to a third party API over multiple synchronous steps and I need to call out to the same API multiple times over a period of 10-30 seconds in order to determine as soon as is reasonable, when that API response changes from Still Processing, to Finished Processing. 

I am currently doing this as follows:
 
var seventhAction = component.get("c.APICall");
seventhAction.setParams({
 "body": GetSalesOrderBody,
 "task": "GetSalesOrderDetails"
})
seventhAction.setCallback(this, function(res) {
 if(res.getReturnValue().includes("InProcess")) {
 console.log("Still Processing Order")
 setTimeout(() => {
    $A.enqueueAction(seventhAction)
 }, 2000)
} else {
console.log(res.getReturnValue())
console.log('Congrats! This API has finished processing and has returned a new order id 
of ' + res.getReturnValue().Id + '');
}

And this function will not recursively call itself... It will just hang there with a console.log() of "Still Processing Order" for up to 5 minutes... However when I click, anywhere on the screen, the task will run as expected. This should not require any user input after it has been fired and I cannot ask my users to just click the screen a ton until the screen goes away. What am i missing here??

Sidenote:
If I run this function without a set timeout, I will execute about 10 times in rapid succession before it hangs itself and awaits click input to get it back on track. I have exhausted my personal supply of potential hacks around/reasons for this problem and am coming up short. Prize goes to the bext answer! 
 
Hey Dev Community!

Im currently working on a Custom Lightning Component and there are a few edge cases that I'm trying to account for. This lightning component makes a few API calls and therefore, may take some time to complete. I need a way to determine if the user bailed mid stream and I can do this easily with a 'Cancel' button with an onclick event that does some logic before calling $A.get("e.force:closeQuickAction").fire();

However, if the user bails with the 'X' in the top right hand corner the API calls cease and I cannot figure out how to handle this. The two ways I have theorized are either react the same way as the button, or make the button the only option but I dont know if I can react to the 'X' click nor if I can hide the 'X' with CSS or some equivalent. 

Any advice would be appreciated!! 
Can someone please explain to me why the following code doesnt execute on its own?? It will only run one time and then requires a touch interaction on the screen to continue to run. Code works as expected if you rapidly click the screen, but hangs itself if the user doesnt click the page.
 
testFunction : function(component, token, tempSo) {
        var action = component.get("c.forLoopTest");
        
        action.setParams({
            "I": 5
        })
        console.log("I ran")
            action.setCallback(this, function(res) {
            

                console.log("Callback ran")
                console.log(res.getReturnValue())
                if(res.getReturnValue() < 20) {
                    setTimeout(() => {
                        console.log(res.getReturnValue());
                        action.setParams({
                            "I": (res.getReturnValue() + 1)
                        })
                        $A.enqueueAction(action)
  
                    }, 500)
                } else {
                    console.log("You did it!")
                }
        

        })
        $A.enqueueAction(action)

    },
 
Apex Controller class  

@AuraEnabled
    public static Integer forLoopTest(Integer I){
        Integer newI = I;
        return newI;
    }

 
Alright community, Im in a real pickle here and hoping someone can shed some light on what I'm doing wrong, and/or what I can do to work around this particular problem.

I have a Custom lightning component that is calling out to a third party API over multiple synchronous steps and I need to call out to the same API multiple times over a period of 10-30 seconds in order to determine as soon as is reasonable, when that API response changes from Still Processing, to Finished Processing. 

I am currently doing this as follows:
 
var seventhAction = component.get("c.APICall");
seventhAction.setParams({
 "body": GetSalesOrderBody,
 "task": "GetSalesOrderDetails"
})
seventhAction.setCallback(this, function(res) {
 if(res.getReturnValue().includes("InProcess")) {
 console.log("Still Processing Order")
 setTimeout(() => {
    $A.enqueueAction(seventhAction)
 }, 2000)
} else {
console.log(res.getReturnValue())
console.log('Congrats! This API has finished processing and has returned a new order id
of ' + res.getReturnValue().Id + '');
}


And this function will not recursively call itself... It will just hang there with a console.log() of "Still Processing Order" for up to 5 minutes... However when I click, anywhere on the screen, the task will run as expected. This should not require any user input after it has been fired and I cannot ask my users to just click the screen a ton until the screen goes away. What am i missing here??

Sidenote:
If I run this function without a set timeout, I will execute about 10 times in rapid succession before it hangs itself and awaits click input to get it back on track. I have exhausted my personal supply of potential hacks around/reasons for this problem and am coming up short. Prize goes to the bext answer! 
I need to hide the close button of quick action model.

I have a date time string from external system that is represented as 10/13/2011 10:36:07 AM

Need to put it in datetime field on sf object. when try to do datetime.parse ('10/13/2011 10:36:07 AM'); it gives me type exception, invalid date time... any workarounds?

  • October 14, 2011
  • Like
  • 0