Find and create Visitors from Salesforce

Sometimes you want to work with Send2CRM Visitors directly in Salesforce. For example, to send mailouts with the visitor id URL parameter matching existing Leads or Contacts.

Invocable action for Flows

Add the Get Send2CRM Visitor action element to your Flow.

This takes two parameters:

  • Create New? Set to True to create a new Visitor if none found, or False to return an empty (null) value.

  • Record Id can be set to either the send2crm__s2cVisitor__c.Id value for existing visitors, or to any valid visitor lookup related object. If a new record is created, it will be automatically related.

If a new record is created, it is returned un-saved. You will need to save it using a Create Records element.

Apex global method

The same functionality as above can be accessed via send2crm.VisitorHelper.getVisitor().

Lead myLead = [SELECT Id, Name FROM Lead WHERE ...]; // Get Send2CRM Visitor related to the Lead. Create if none found. send2crm__s2cVisitor__c visitor = send2crm.VisitorHelper.getVisitor(myLead.Id, true); if (visitor.Id == null) { // New visitor, save. Database.insert(visitor, true); } // Use the web id value for identification in a website URL link. String webLink = 'https://mysite.com/promotionurl?s2cid=' + EncodingUtil.urlEncode(visitor.send2crm__Web_Id__c, 'UTF-8');

Â