Policy Automation for B2C Service

Get Involved. Join the Conversation.

Topic

    Blessing Matore
    Submit and RedirectAnswered
    Topic posted September 13, 2017 by Blessing MatoreBlue Ribbon: 750+ Points 
    269 Views, 4 Comments
    Title:
    Submit and Redirect
    Content:

    Hi,

    I have two (contact/agent) interviews on customer portal that I want to appear as one to the user. First interview does captures basic user information (lead capture), creates an incident in Service Cloud. The NEXT button on interview1 is a submit and redirect which sends the incident id to interview2.

    This is because checkpoints wont let you report on the actual answers users provide during interviews if they don't complete the interview.

    https://site.custhlep.com/web-determinations/startsession/interview1?seedData={incident_id:%incident_id}

    My expectation was when interview 2 opens it loads data from the incident created by interview 1, and shows contact details of the logged on user.

    I get an error that interview 2 is only for logged in contacts or agents (even though I am logged in). If I switch the interview to allow anonymous users, interview 2 opens but no data is loaded at the start of the interview. Mapping settings for interview 2 are set to 'also load data related to a particular: Incident'

    Seems that OPA doesn't know who the user that came from interview 1 is even when a user is logged on?

    Version:
    Service Cloud August 2017, OPA August 2017

    Best Comment

    Scott Berry

    Hi,

    Firstly I'll go into detail about why this isn't working: The OPA widget in Service Cloud generates a token for the logged in user to pass to OPA to securely request to load data at the start of the interview, but passes this to the iframe that gets embedded on the Service Cloud page. The interview proceeds within the iframe to the end, but the redirection acts on the iframe only, not the page hosting it, so the interview-generated redirect URL doesn't have access to the code which generates the security token (this is one of the main functions of the OPA Widget).

    So even if you were to construct the URL using the user's ID, it would still lack the token required to begin the second interview.

    I can only think of one possible workaround until we develop an in-interview way of generating these security tokens or alternate solution. Note: I haven't tested this idea, but if it's really blocking you then it's the only thing to try!
    The logic to generate the token is in the OPA Widget controller and helper php files provided in the example widget's documentation: if that same logic were used directly on a blank php page, it might be possible to redirect the user (within the iframe) to that page, the page then generates a new token for the user, and immediately redirects them to "interview 2"
    i.e. the Submit and Redirect button aims the iframe at [mysite].xyz/opa-redirect.php?policy_model_name=myInterview&initID=78
    that php page then generates the token along with the passed in interview and init ID, then redirects to that URL, generated using the existing widget logic.

    Without testing this myself I can't see any reason why this wouldn't work, except perhaps in older versions of IE (I think they do something like prevent iframes' access to cookies, and therefore the logged in user?)

    Hope this helps, and gives you food for thought.
    -Scott

    Comment

     

    • Scott Berry

      Hi,

      Firstly I'll go into detail about why this isn't working: The OPA widget in Service Cloud generates a token for the logged in user to pass to OPA to securely request to load data at the start of the interview, but passes this to the iframe that gets embedded on the Service Cloud page. The interview proceeds within the iframe to the end, but the redirection acts on the iframe only, not the page hosting it, so the interview-generated redirect URL doesn't have access to the code which generates the security token (this is one of the main functions of the OPA Widget).

      So even if you were to construct the URL using the user's ID, it would still lack the token required to begin the second interview.

      I can only think of one possible workaround until we develop an in-interview way of generating these security tokens or alternate solution. Note: I haven't tested this idea, but if it's really blocking you then it's the only thing to try!
      The logic to generate the token is in the OPA Widget controller and helper php files provided in the example widget's documentation: if that same logic were used directly on a blank php page, it might be possible to redirect the user (within the iframe) to that page, the page then generates a new token for the user, and immediately redirects them to "interview 2"
      i.e. the Submit and Redirect button aims the iframe at [mysite].xyz/opa-redirect.php?policy_model_name=myInterview&initID=78
      that php page then generates the token along with the passed in interview and init ID, then redirects to that URL, generated using the existing widget logic.

      Without testing this myself I can't see any reason why this wouldn't work, except perhaps in older versions of IE (I think they do something like prevent iframes' access to cookies, and therefore the logged in user?)

      Hope this helps, and gives you food for thought.
      -Scott

    • Danette Beal

      Thanks for the write up Scott!!

      Blessing, did Scott's comment help you?

      Danette, Community Manager

    • Blessing Matore

      Hi Scott, thanks for your insightful reply. Your workaround works but only after allowing:

      <rn:widget path="utils/ClickjackPrevention" allow_from="https://example.custhelp.com/app/interview"/> 

       

    • Danette Beal

      You're the best Blessing! Thanks for coming back and letting us know.

      Danette, Community Manager