New answers tagged

2

For multi-picklist you need to use INCLUDES. For example: INCLUDES(MultiPicklistField__c, "sometext") There is no need to use IF formula since INCLUDES returns TRUE/FALSE already. Check out the documentation.


2

The OR function does not help you at all here. Nesting If functions is one valid way to execute this logic, though the CASE function uses fewer formula characters: CASE( Account.RecordType.Name, "ABC", Account.ABC__r.Name, "XYZ", Account.XYZ__r.Name, null )


3

String externalId = 'SOMETHING'; ChildObject__c childObject = new ChildObject(); childObject.Account__r = new Account(ExternalId__c = externalId); insert childObject; You don't need the external Id on the child record. EDIT: Relevant documentation


0

IF syntax is this IF( CONDITION, TRUE, FALSE ) Your formula has syntax errors please try this IF( OR( sitetracker__Project_Manager__c = $User.Id , Admin__c = $User.Id, Lease_Administrator__c = $User.Id, ActivityOwner__c = $User.Id ), 1, 0 )


1

You could use CONTAINS: IF( CONTAINS( sitetracker__Project_Manager__c&':'& Admin__c&':'& Lease_Administrator__c&':'& ActivityOwner__c, $User.Id), 1, 0 ) The & operator is a string concatenation.


2

Yes, you can reference data on a parent object (such as RecordType) in a formula, much in the same way you can with a SOQL query (by using dot notation). RecordType.Name Of course, if you simply include the recordType field on the page layout, you get this for free. No need to create a new field (unless you want to use the record type name in a trigger ...


0

Okay I have finally resolved the issue! The solution is bizarre and makes no sense to me. I directly copied and pasted the API name values from the picklist into the formula field. There was absolutely no difference in the values, but for some reason that seems to have worked.


0

Simplified everything for myself from the examples below, maybe you will come in handy :) public static Integer getWeekdayNumberFromDate(Date fromDate) { return Integer.valueOf(((Datetime) fromDate).format('u')); }


0

Here is another approach which is similar to @Mahmood's answer, but this requires a master-detail relationship between Opportunity and Job Document object. Creating a Roll-Up Summary field Latest Job Document on Opportunity, choose Job Document as the Summary object, and use MAX formula to aggregate the date field. Create a formula field of type Checkbox ...


0

One approach Add to Opportunity a field called Most_Recent_Job_Doc_Datetime__c Set by a trigger on Job Document (handles insert, update, delete) , or, more easily, use DLRS to do this without code Add a formula checkbox field on Job_Document__c called Is_Most_Recent__c that is compares the Job Document's datetime to the Opportunity....


0

Your idea is fine, but how about Creating a datetime field on Opportunity, call it Latest Job Document. Fill it with CreatedDate when a Job Document record is created, using a Workflow or Process builder. Now that Opportunity (Parent) has the datetime reference, you can leverage it using a field in Job Document. Create a cross-object formula field on Job ...


0

So, you are correct that formula fields can not take advantage of dated exchange rates An Opportunity will always use Dated Exchange Rates on all Currency fields with CloseDate being the lookup key across the configured Dated Exchange Rates. If you wanted an Opportunity field to use a different exchange rate than would be specified by the CloseDate, you need ...


1

Generally speaking, this is correct, but be mindful of your data types. If Bounce_Type_Code__c is a numeric field, you would not enclose the match values in quotes (e.g. 3 instead of '3'). Other than that, it looks just fine.


1

This is much more easily solved with the CASE statement; this eliminates the 20+ extra parentheses you'd need, plus all of the AND operators. Here's the revised logic based on your nested bullet list: CASE(Source_System__c, 'Adobe', CASE(Type__c, 'Deliverability', CASE(Email_Event_Status_Code__c, 127, 'Not Applicable', ...


1

Make use of URLFOR function in formula builder to do so:- {! URLFOR( "https://example-blank.com/page.html?", null, [id=Mission__c.Id] ) } to build effective URL for your custom link. Read more here:- Constructing Effective Custom URL Buttons and Links


0

I eventually went with NOT(REGEX(Custom_Field__c, "^(?=(?:\\D*\\d){2})[a-zA-Z0-9]*$")) Thank you


0

The REGEX function in Salesforce formulas needs to have \ characters escaped (documentation). I believe a straightforward formula like this should work: NOT(REGEX(\\d{2,})) This will check that there are at least two digits in sequence within the string. Your original regex may have some problems. I could not get it to match your expected input on regexr....


Top 50 recent answers are included