SalesforceLabs / survey-force

85 stars 61 forks source link

Need to associate an opportunityid to a survey force response. #91

Closed sumitsourav333 closed 3 years ago

sumitsourav333 commented 3 years ago

Hi Everyone,

I've embedded the survey link in email template and the template is sent to contact via apex email to submit surveys.

Functionality : Whenever an opportunity is closed won or lost all it's associated contact roles should receive the survey link. Whenever an opportunity is moved to the win or loss stage it sends the surveylink along with that it stamps the opportunity on contact for which the survey has been triggered.

When we have a 90 days cooling period a contact will not receive the survey link for 90 days once he has already received it. This time period was sufficient for any contact to submit the survey . After submission of survey it comes to org and checks for the stamped opportunity on contact (which was stamped when the survey was triggered) for which the survey was sent and with the help of workflow the opportunity is associated to the survey response.

Issue:

Let's say we have contact1 which is associated with opportunity1 and opportunity2. Now today opportunity 1 is closed in won stage so contact1 will have opportunity1 stamped as last survey sent opportunity. Now let's say contact1 doesn't submit the survey right away. Tomorrow opportunity 2 is closed in the lost stage now contact1 will get stamped by opportunity2 as last survey sent opportunity. Now contact1 has two survey links one from opportunity1(Win) and other from opportunity2(Loss). Now contact1 submits both the survey. After submission of the survey it'll come to org to check contact1's stamped opportunity and since the stamped opportunity will be the recently closed opportunity2. So only Opportunity2 will be associated with both the responses.

Can anyone help me or educate me on how to associate an opportunity with a survey force response?

Thanks, Sumit

jrattanpal commented 3 years ago

You could make changes where you can add another custom field on "Survey Taken" object to link that survey directly to an opportunity (as well as Contact). This will be far less complex.

There was another enquiry similar to this and I posted "how to" at https://github.com/SalesforceLabs/survey-force/issues/85

Because Survey Force is un-managed package, you own the code and make changes as needed.

sumitsourav333 commented 3 years ago

@jrattanpal

Sorry for the delayed response. I was waiting for the client to respond to me regarding this functionality. But thank you so much for your instant reply. This solution worked for me and I've deployed in production as well.

Just wanted to know one thing- for me this survey force functionality is working in UAT and prod on public sites. In dev org the url that is generated shows error as broken url please contact salesforce. 1.Can you please help me in knowing why this error is shown?

  1. The difference in terms of survey functionality between UAT and dev org is in dev org I've enabled community as well as public site . At the starting I was just exploring the package and thus had enabled community. When this survey functionality didn't work on community then I changed to public sites and done the same configuration that I had done in UAT. Now the URL generated to open survey on public sites in dev org throws an error saying the url is broken. please contact salesforce. It'll be really helpful if you can explain the root cause.

Thanks, Sumit

jrattanpal commented 3 years ago

Sumit,

What version of app do you have? Previously, the logic to generate URL on the Share screen (when you open the survey to view) was faulty. I had changed it to generate correct link in later versions.

In any case, what you need to do is this.

sumitsourav333 commented 3 years ago

@jrattanpal

I was using survey force version 2.47. But thank you so much for your response. Broken URL problem is also resolved by appending URL from "/TakeSurvey......." in public site URL.