I'm building a custom pre-chat form that I'm using with a snap-ins chat deployment. I am using it in a Salesforce community and everything works great except I have no way of sending specific cases that I want to attach to the transcript and to display to the agent. I know exactly how to do this using the code snippet route, but since the chat is being used in the community there is no way to access any of the embedded_svc information because of locker service. I tried making a visualforce page and using the snippet, which allowed me to access embedded_svc, however it broke the chat altogether. Any ideas for how to pass an existing case ID to the chat so that it shows the existing case instead of making a new one? I've tried at least ten different ways to do this, but all have failed. Thanks everyone in advance.
-
1Definitely can help you...can you paste your vf code here?– AyubCommented May 25, 2018 at 18:35
-
1I won't be able to use vf because it completely breaks the snap-in, since it's in a salesforce community. I need a way to access this in the lightning component controller javascript– Brett WagnerCommented May 25, 2018 at 18:39
-
Are you using this approach: developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/…– AyubCommented May 25, 2018 at 18:42
-
Yes, that's exactly what I'm using. It makes a new case with all of the fields that I want just fine with that.– Brett WagnerCommented May 25, 2018 at 18:44
-
1Looks like I found a solution here: salesforce.stackexchange.com/questions/219463/…– Brett WagnerCommented May 25, 2018 at 19:05
2 Answers
I found the answer here: Include static resource with ltng:require as it is I knew that locker service was causing all of my issues, but had no idea that switching to API version 39 or below would solve my problem. It worked!!
Were you able to use both Custom Pre-Chat Component Sample Using Aura and Snap-Ins Chat Code?
Custom Pre-Chat Component Sample Using Aura https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_lightning_components_prechat_sample_aura.htm
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/snapins.pdf Able to customize your snap using embedded_svc?
If so, would you mind sharing some example code, or approach on how to do it?
-
That's what I'm trying to do, yes. I haven't got it fully working yet, but if I do then I will gladly share, as I haven't been able to find any information on trying to do it this way. Commented May 29, 2018 at 11:55
-
So, what I ended up doing was when a user wanted to chat about an existing case I set the subject as the existing case Id. Then, I wrote a case trigger that filtered out these cases, set the parent Id as the existing case Id. Finally, I wrote a visualforce page that I'm using on the case layout for the console that will find the "temporary" case, open the existing case based off of the parentId, then it will close the temporary case tab. When a chat has ended, my LiveChatTranscript trigger sets the case Id on the transcript to the existing case Id and deletes the temp case. Works quite nice. Commented Jun 7, 2018 at 16:52