Impact of Salesforce to Salesforce on Validation Rules and Apex Triggers - Story From: Popular Ideas

March 11th, 2010

We've received a number of questions from customers on the impactof Salesforce to Salesforce on existing or new validation rules and apextriggers. The reality is when two companies connect their salesforce.cominstances, in most cases each company has its own unique set of validationcriteria and triggers.Additionally, these criteria might be looking at fields that haven't even beenshared between the connected companies. Today, if a customers accepts arecord from a connection and that record fails to meet validation or triggercriteria we provide a generic error message stating: 0 records accepted.It is on our roadmap to provide more useful error messages as well as log theseerrors in the Connection Audit so the customer can do something aboutit.

There is a way, however, for customers to bypassvalidation rules and triggers when either accepting a record from aconnection or receiving an update on a connected record from theconnection. The basic idea here is that we bypass these organizationspecific rules when first accepting the record or when a connection updates therecord but these same rules are enforced if an internal user creates a newrecord or updates an existing record. This is how most of our customershave configured their connections. Once you make these changes- you're organization's rules will be Salesforce to Salesforce aware.It is good practice to include the tasks below in any S2S roll-out plan orwhen creating a validation rule or apex trigger.

Changes to Validation rules: the following should be includedwithin an 'AND' statement with the rest of the rule

  Validation_3

Text version:

IF(OR(ISNEW(), ISNULL(Id)), if(ConnectionReceivedId =null, TRUE, FALSE),NOT(AND(ISCHANGED(ConnectionReceivedId), NOT(ConnectionReceivedId = null)))),

NOT(Contains($User.Alias, "pnet"))

Example of Apex Trigger that is S2S aware: sample below is on Opportunities(same logic for other objects)

Apex trigger

Apex_trigger_on_opp_3


Apex class

Apex_class

If you have any questions on this topic, email: s2s@salesforce.com

Categories: AppExchange, CRM Free Trial, CRM Sales Software, Cloud2, Contact Management Software, Customer Relationship Management, DreamForce, Salesforce CRM, Social Media, Web Based Contact Management Software Free Review

Tags: , , , , , , , , , , , , , , , , , , Leave a comment

Feed

http://www.web-basedcrmsoftware.net/crmsoftwareblognow / Impact of Salesforce to Salesforce on Validation Rules and Apex Triggers