In our app developed with mobile SDK (iOS and Android) we have the option for users to be already logged in, when the user of the app calls the chat we want to send his data through a hidden pre-chat, but when we do that the data does not go to Salesforce. Different when we send the same visible data, because it works.

Have you been through this? Do we have a solution?

We are using the standard SCSPrechatObject class

let fields: [SCSPrechatObject] = [
            SCSPrechatObject(label: "Nome", value: self.customer?.firstName ?? ""),
            SCSPrechatObject(label: "Email", value: self.customer?.email ?? ""),
            SCSPrechatPickerObject(label: "Motivo", options: self.buildPickListField())?.apply { $0.isRequired = true },
            SCSPrechatObject(label: "Origin", value: "Chat App")
        ].compactMap { $0 }
        let entities: [SCSPrechatEntity] = [
            SCSPrechatEntity(entityName: "Contact").apply {
                $0.saveToTranscript = "Contact"
                $0.linkToEntityName = "Case"
                $0.linkToEntityField = "ContactId"
                $0.entityFieldsMaps.apply { entity in
                    entity.add(SCSPrechatEntityField(fieldName: "FirstName", label: "First Name").apply { firstName in
                        firstName.doFind = true
                        firstName.isExactMatch = true
                        firstName.doCreate = true
                    entity.add(SCSPrechatEntityField(fieldName: "Email", label: "Email").apply { emailEntityField in
                        emailEntityField.doFind = true
                        emailEntityField.isExactMatch = true
                        emailEntityField.doCreate = true
            SCSPrechatEntity(entityName: "Case").apply {
                $0.saveToTranscript = "Case"
                $0.showOnCreate = true
                $0.entityFieldsMaps.apply { entity in
                    entity.add(SCSPrechatEntityField(fieldName: "Origin", label: "Origin").apply { $0.doCreate = true })
                    entity.add(SCSPrechatEntityField(fieldName: "Reason", label: "Motivo").apply { $0.doCreate = true })
        config?.prechatFields = fields
        config?.prechatEntities = entities

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.