SalesforceLabs / survey-force

86 stars 61 forks source link

Person Account Survey Force - IFrameOrigin Null #137

Closed LuciaMCSF closed 2 years ago

LuciaMCSF commented 2 years ago

Hi, I have created a survey, published it on a site, having used as sharing option the "Email Link w/Contact Merge".

I'm using the link in Marketing cloud retrieving the ContactID through Ampscript. The email and the link are correct and answers are sent back to Salesforce (I can see them in the survey reports).

Unfortunately answers are not linked to the contacts. Consider we are using Person Account.

This is an example of the link from Marketing Cloud to the VF page in SF:

https://companyname.secure.force.com/TakeSurvey?id=a0d7U00000XXXXXX&cId=0037XXXXXXXX%7D&caId=none

And this is the url when I submit the form:

https://companyname.secure.force.com/TakeSurvey?id=a0d7U000000xxxxx&sfdcIFrameOrigin=null

I suppose the issue comes from the Person Account and I wonder if you can give some instructions in order to solve this problem. I can't find any documentation on this. Thanks so much

jrattanpal commented 2 years ago

Where do you get the Contact ID from Person Account? Did you create a new contact from the Person account? or is it the behind-the-scenes Contact ID for the person account?

I haven't tested this scenario but I think you may need to use an account ID. In that case, you will need to change the code to add that feature as the current functionality is only for contact and case.

jrattanpal commented 2 years ago

I just tested it and it's working for me. I retrieved the contact ID from person account with "Select PersonContactId, Name From Account".

Then I used that in URL and it worked without any code change. I can see "Account Name" listed in the lookup field. When I click it, I takes me to person account.

I am not sure why it's not working for you. It maybe what you mentioned "And this is the url when I submit the form:". If that is the URL when form is submitted then contact ID ("cid") is missing in that URL. You need to check why the end URL (When form is submitted) is missing the contact id

LuciaMCSF commented 2 years ago

Thank you @jrattanpal May I ask how can I check on Survey force why the end URL is missing the contactId? Because instead of the ContactId I see this [sfdcIFrameOrigin=null] and I don't understand if this is something that I have to investigate outside Survey Force. Thanks again

jrattanpal commented 2 years ago

Yes, this is outside of survey force.

You mentioned that you send following URL from marketing https://companyname.secure.force.com/TakeSurvey?id=a0d7U00000XXXXXX&cId=0037XXXXXXXX%7D&caId=none

But the submission URL (where user fills the form) is https://companyname.secure.force.com/TakeSurvey?id=a0d7U000000xxxxx&sfdcIFrameOrigin=null

Somewhere along the line, it looses "cid" and "said". You will need to figure out why those are missing and at what point.

You can confirm that this is not survey force issue by

Check if Contact ID is saved (it did for me)

If that works (And it should) then that confirms surveyforce is working without issues

LuciaMCSF commented 2 years ago

Thanks @jrattanpal

LuciaMCSF commented 2 years ago

[](url Schermata 2022-02-23 alle 07 54 18 )

LuciaMCSF commented 2 years ago

@jrattanpal I have tested as per your suggestion and this is what I see (previous comment) using the dummy test and the link outside Marketing Cloud. Could be something related to permissions? Thanks again

jrattanpal commented 2 years ago

URL in that screenshot is wrong. it should be in the following format

https://companyname.secure.force.com/TakeSurvey?id=a0d7U00000XXXXXX&cId=0037XXXXXXXX%7D&caId=none

LuciaMCSF commented 2 years ago

Thanks, @jrattanpal - upon further verification, the survey responses are linked to the correct person account, however, when the customers submit the answers, the error provided above persists. I think it might be related to some permissions - but I haven't figured out which permissions. Additionally, it might have something to do with the redirect of the page. Have you encountered this issue before? Thank you in advance for your help!

jrattanpal commented 2 years ago

@LuciaMCSF

This shouldn't happen. On submit, they should see a thanks message. I am not sure why you are seeing that but I haven't seen this issue before.

You can try attaching the apex debug log and I'll see if I can figure out what may be happening

LuciaMCSF commented 2 years ago

@jrattanpal In the debug log I don't see any error. As you can see from the attached screenshot of the debug logs. All seem to be correct (Operazione riusciuta= Successful activity) but I see some operations are indicated as "/apex/unauthorized". I hope this helps apex_SurveyForce

jrattanpal commented 2 years ago

It's log file after Unauthroized that you need to share. "TakeSurvey" one.

jrattanpal commented 2 years ago

Are you using the setting no survey where you redirect users to another URL when it's completed? Rather than thank you page?

It seems you have set it to "www.WEBSITE.com".

if you want that then I think you need to change that to "http://www.WEBSITE.com" (or https://; whatever is correct)

If not then you need to remove that. It will be in one of the tabs when you edit survey

LuciaMCSF commented 2 years ago

@jrattanpal putting the http in front of the website name I solved this issue. Thank you for your kindness and help!

LuciaMCSF commented 2 years ago

I can close the issue as it has been solved.