Writing Custom Formula Fields for Opportunity Dynamic Window of Influence

When using MagicRobot, you can specify a Number field on the Opportunity so that each Opportunity is treated uniquely by the application, and gives each Opportunity the specified window of influence.

In most cases, the easiest and safest way to implement this is by using a Custom Formula field on the Opportunity.

Let’s do an exotic example that should illustrate a few ideas.

Let’s say that if an Opportunity has these attributes, we want to treat them in the manner specified, otherwise, just use the global setting for number of days specified in the settings:

– If Opportunity Type = ‘New Business’ and Segment = ‘Enterprise’, then Days of Influence Window should be 365
– If Opportunity Type = ‘Renewal’, then Days of Influence Window should be 60
– If Opportunity’s Country is France, then Days of Influence Window should be 90

It’s very simple to translate these requirements into a custom formula field which evaluates downward until it finds a condition that’s true:

/* First we specify New Business and Enterprise with an imaginary custom field on the User called ‘Business_Segment__c’*/
ISPICKVAL(Type, “New Business”),
ISPICKVAL(Owner.Business_Segment__c, “Enterprise”)

/* if the evaluation has gone this far, it didnt meet the previous conditions */
/* now lets specify renewal
ISPICKVAL(Type, “Renewal”),
LOWER(Account.BillingCountry) = “france”,
LOWER(Account.BillingCountry) = “fr”,
LOWER(Account.BillingCountry) = “fr.”
/* this is the final ‘otherwise’ result
we will set it to Null and then the application will fill in the global setting