Salesforce Opportunity ID not being passed after a PostResponseMap Hook

Comments

9 comments

  • Lucian Hymer Senior Solutions Consultant

    Hey David,

    What's the output if you hit Preview?

    Thanks,
    -Lucian

    0
  • David Romstad
    Celigo University Level 1: Skilled
    Awesome Follow-up
    Engaged

    Hey Lucian,

      None of the fields get populated.  Where as before putting the hook in it would populate all fields green, with correct information.

    0
  • Lucian Hymer Senior Solutions Consultant

    Hey David,

    Yeah, I don't think that postResponseMapData is an actual variable. So you're returning blank data. (Edit: this is the right variable)

    I'd start a new script and insert the postSubmit stub function. Hit Preview and look at the output that you get. It should include an ID, code, etc.. Then, start doing your transformation but make sure that you still have all those same fields (id, code) in the output. The hook is expecting data the data to have that particular structure.

    Does that make sense?

    0
  • David Romstad
    Celigo University Level 1: Skilled
    Awesome Follow-up
    Engaged

    It does make sense in theory,  in practice I get a little twisted around. 

    It almost seems like a tug of war, on one hand when I use responseData I do not get the correct error responses, and it requires me to put in postResponseMapData. Perhaps a little more practice is in order, but I appreciate your response. Basically the data is not getting passed because of the variable. 

     

    0
  • Lucian Hymer Senior Solutions Consultant

    Well ultimately, the issue is that the output is not formatted how the tool is expecting. Actually after taking a second look, I think that postReponseMapData is the correct variable. You just need to make sure that your output matches the format that the initial postResponse stub creates, i.e. an array where each object has an "id" field.

    0
  • David Romstad
    Celigo University Level 1: Skilled
    Awesome Follow-up
    Engaged

    I am not sure what the missing piece is.

    The retry data clearly has the field that is matched on. 

    0
  • Lucian Hymer Senior Solutions Consultant

    Hey David,

    You've introduced an extra level in your object there. The key would now be "responsedata.OpportunityId".

    Again, if you look at the preview output of just the stub function you'll see that it doesn't match.

    Your retry data should just look like:

    {
    "Item": [{...}],
    "OpportunityId": "bla",
    ...
    }

    Note that there's no top-level "responsedata" key.

    Don't hold me to this, but I think if you just got rid of your final map (lines 64-68) and made it just:

    return options.postResponseMapData;

    Then I believe it'll work.

    0
  • David Romstad
    Celigo University Level 1: Skilled
    Awesome Follow-up
    Engaged

    You were 100% correct.  That makes so much sense now. Thank you very much for the help!

    This sure caused a pretty massive headache, so thank you!

    0
  • Lucian Hymer Senior Solutions Consultant

    Awesome, I'm glad that worked!

    0

Please sign in to leave a comment.