Skip to content

Instantly share code, notes, and snippets.

@Fossiltalk
Fossiltalk / timetoemojiformula.js
Created December 31, 2025 21:11
Formula field which translates the time into its corresponding emoji
CASE(
MOD(
FLOOR(
(
MOD(HOUR(TIMENOW() - 18000000), 12) * 60 +
MINUTE(TIMENOW() - 18000000) +
15
) / 30
@Fossiltalk
Fossiltalk / randomformula.js
Last active July 15, 2024 15:14
This snippet describes a formula that generates a 5-digit random number.
//This returns a text value. If you need it to return an integer, you can simply wrap the whole thing in a "VALUE()" formula.
RIGHT(
TEXT(
PI()*(
ASCII(RIGHT(Id,1))*ASCII(RIGHT(Id,2))*ASCII(RIGHT(Id,3))
)/ UNIXTIMESTAMP(CreatedDate)
), 5
)
@Fossiltalk
Fossiltalk / FlowDataTool_Test.cls
Last active July 13, 2024 21:28
These classes create an invocable method that can be used inside a Flow to generate a random number.
@isTest
public without sharing class flowDataTool_Test {
@isTest
private static void getRandom_test() {
flowDataTool.randFlowInput tempInput = new flowDataTool.randFlowInput();
tempInput.smallestNumber = 0.0;
tempInput.largestNumber = 100.0;
tempInput.precision = 2;
/*////////////////////////////////////////////////////////////////////////////////////////
// //
// Summary: A Dev Console Script to Delete Work-Items from Salesforce DevOps Center //
// //
////////////////////////////////////////////////////////////////////////////////////////*/
String deployToDelete = 'WI-XXXXXX'; //Replace this value with the Work Item you want to delete.
List<SObject> deploymentRecordsToClear = new List<Sobject>();
List<SObject> workItemToDelete = (List<SObject>) [SELECT Id FROM sf_devops__Work_Item__c WHERE Name = :deployToDelete LIMIT 1];