Is it Possible to use the Result of Callout1 in Callout2?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
3
down vote

favorite












I need to generate an access token with an HTTP callout and make use of that access token in another HTTP callout. These 2 HTTP callouts are future methods being called inside a Scheduled class. Is it possible to make use of the result from Callout1 for my callout2?







share|improve this question




















  • Why Callout1 and Callout2 are different future method?
    – Saroj Bera
    Aug 16 at 6:31
















up vote
3
down vote

favorite












I need to generate an access token with an HTTP callout and make use of that access token in another HTTP callout. These 2 HTTP callouts are future methods being called inside a Scheduled class. Is it possible to make use of the result from Callout1 for my callout2?







share|improve this question




















  • Why Callout1 and Callout2 are different future method?
    – Saroj Bera
    Aug 16 at 6:31












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I need to generate an access token with an HTTP callout and make use of that access token in another HTTP callout. These 2 HTTP callouts are future methods being called inside a Scheduled class. Is it possible to make use of the result from Callout1 for my callout2?







share|improve this question












I need to generate an access token with an HTTP callout and make use of that access token in another HTTP callout. These 2 HTTP callouts are future methods being called inside a Scheduled class. Is it possible to make use of the result from Callout1 for my callout2?









share|improve this question











share|improve this question




share|improve this question










asked Aug 16 at 6:12









cookie

407




407











  • Why Callout1 and Callout2 are different future method?
    – Saroj Bera
    Aug 16 at 6:31
















  • Why Callout1 and Callout2 are different future method?
    – Saroj Bera
    Aug 16 at 6:31















Why Callout1 and Callout2 are different future method?
– Saroj Bera
Aug 16 at 6:31




Why Callout1 and Callout2 are different future method?
– Saroj Bera
Aug 16 at 6:31










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










Not in this case, because you can't even be sure of the order the two future calls are going to be executed. You're going to want to put both callouts inside of one @future method and just call that one from the scheduled code.






share|improve this answer




















  • I actually wasn't aware of whether the order was maintained, good to know!
    – Matt Lacey♦
    Aug 16 at 6:46






  • 1




    Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
    – sfdcfox
    Aug 16 at 6:54











  • I've always treated them like operator precedence in a new language, and don't assume anything :)
    – Matt Lacey♦
    Aug 16 at 6:56






  • 1




    Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
    – cookie
    Aug 16 at 8:02










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229056%2fis-it-possible-to-use-the-result-of-callout1-in-callout2%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










Not in this case, because you can't even be sure of the order the two future calls are going to be executed. You're going to want to put both callouts inside of one @future method and just call that one from the scheduled code.






share|improve this answer




















  • I actually wasn't aware of whether the order was maintained, good to know!
    – Matt Lacey♦
    Aug 16 at 6:46






  • 1




    Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
    – sfdcfox
    Aug 16 at 6:54











  • I've always treated them like operator precedence in a new language, and don't assume anything :)
    – Matt Lacey♦
    Aug 16 at 6:56






  • 1




    Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
    – cookie
    Aug 16 at 8:02














up vote
4
down vote



accepted










Not in this case, because you can't even be sure of the order the two future calls are going to be executed. You're going to want to put both callouts inside of one @future method and just call that one from the scheduled code.






share|improve this answer




















  • I actually wasn't aware of whether the order was maintained, good to know!
    – Matt Lacey♦
    Aug 16 at 6:46






  • 1




    Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
    – sfdcfox
    Aug 16 at 6:54











  • I've always treated them like operator precedence in a new language, and don't assume anything :)
    – Matt Lacey♦
    Aug 16 at 6:56






  • 1




    Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
    – cookie
    Aug 16 at 8:02












up vote
4
down vote



accepted







up vote
4
down vote



accepted






Not in this case, because you can't even be sure of the order the two future calls are going to be executed. You're going to want to put both callouts inside of one @future method and just call that one from the scheduled code.






share|improve this answer












Not in this case, because you can't even be sure of the order the two future calls are going to be executed. You're going to want to put both callouts inside of one @future method and just call that one from the scheduled code.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 16 at 6:29









Matt Lacey♦

20.5k543114




20.5k543114











  • I actually wasn't aware of whether the order was maintained, good to know!
    – Matt Lacey♦
    Aug 16 at 6:46






  • 1




    Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
    – sfdcfox
    Aug 16 at 6:54











  • I've always treated them like operator precedence in a new language, and don't assume anything :)
    – Matt Lacey♦
    Aug 16 at 6:56






  • 1




    Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
    – cookie
    Aug 16 at 8:02
















  • I actually wasn't aware of whether the order was maintained, good to know!
    – Matt Lacey♦
    Aug 16 at 6:46






  • 1




    Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
    – sfdcfox
    Aug 16 at 6:54











  • I've always treated them like operator precedence in a new language, and don't assume anything :)
    – Matt Lacey♦
    Aug 16 at 6:56






  • 1




    Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
    – cookie
    Aug 16 at 8:02















I actually wasn't aware of whether the order was maintained, good to know!
– Matt Lacey♦
Aug 16 at 6:46




I actually wasn't aware of whether the order was maintained, good to know!
– Matt Lacey♦
Aug 16 at 6:46




1




1




Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
– sfdcfox
Aug 16 at 6:54





Actually, this document explains it better. I think there are some possible situations where f2 might beat f1 out of the gate, depending on a very specific set of circumstances. So ignore my previous comment. That said, it's probably very very rare that this happens... I've never observed it before.
– sfdcfox
Aug 16 at 6:54













I've always treated them like operator precedence in a new language, and don't assume anything :)
– Matt Lacey♦
Aug 16 at 6:56




I've always treated them like operator precedence in a new language, and don't assume anything :)
– Matt Lacey♦
Aug 16 at 6:56




1




1




Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
– cookie
Aug 16 at 8:02




Never thought it's okay to put 2 HTTP requests in one future method. It worked. Thanks for the suggestion.
– cookie
Aug 16 at 8:02












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f229056%2fis-it-possible-to-use-the-result-of-callout1-in-callout2%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?