New answers tagged

1

If you're simply trying to get the epoch, you can use the Datetime.getTime() method. getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this DateTime object. Here's an anonymous script to get you started: Datetime timestamp = Datetime.newInstance( Date.newInstance(2020, 18, 2), Time.newInstance(9, 0,...


1

Just create a custom field of type URL and populate it with Apex (or however). Here's the documentation: https://help.salesforce.com/articleView?id=custom_field_types.htm&type=5


1

You could turn on Field History Tracking for the Status field and that would log not only when it changed, but who did it as well as current and prior values.


1

You can use a Process Builder/Workflow Rule/Trigger to achieve this. Just create a custom Date/Time field, choose the appropriate method you want to use (e.g. Process Builder), define the action to fire when it meets your criteria (e.g. ISCHANGED(StageName) && NOT(IsClosed)), and use an action to set the Date/Time field.


1

Not a direct answer to this question but a suggestion for an alternative approach: Set up record types for your repair record object Add a process builder to set the record type based on your picklist values (see this example How to change record type by workflow?) Add record type based permissions to your user profiles)


3

try this simple validation rule: my bad, I updated the sol AND ( NOT(ISNEW()), IF (ISCHANGED(Status__c), ISPICKVAL(PRIORVALUE(Status__c),'Completed'), ISPICKVAL(Status__c, 'Completed') ) )


2

If cod1__c, cod2__c, cod3__c, or cod4__c are also formulas, then their compiled size counts towards the compiled size of your formula. It could be that one of those are formulas, and were subsequently later edited to be longer than original, thus expanding the compiled size of this formula. There's also a small variation in formula size if the picklist ...


1

Open the Developer Console, change the default Log Levels (Debug > Change Log Levels... > Add/Change > Workflow=FINEST), then perform an operation (insert/update/whatever). You'll see a new log, that will contain lines like this: 15:36:02.2 (398764976)|WF_RULE_EVAL_BEGIN|Workflow 15:36:02.2 (398983642)|WF_CRITERIA_BEGIN|[Client: demo 0011T00002Pndvj]|...


2

For whatever reason, as noted here, you seem to get the label if you refer to the field, but you get the value if you pass the field into a record element/variable. As @Mitesh stated, you should be able to store the Choice Value as a variable and get what you need. Create the variable. Click on Manager --> New Resource Select Variable for Resource Type. ...


0

I would try this instead: IF ( TEXT( Related_Contract_Record__r.Contract_Status__c ) == "Cancelled", 'Cancelled', 'NotCancelled') and for your checkbox: IF ( TEXT( Related_Contract_Record__r.Contract_Status__c ) == 'Cancelled' ), TRUE, FALSE ) You should see that your formula will then evaluate accordingly. The only time there would be any ...


3

Not really. You can kind of do this using a row level formula (can be created in lightning report from dropdown next to 'columns' text). Year column can be created like so (formula output type = text): TEXT(YEAR(--date field goes here --)) But you only get one row level formula for each report, so you wouldn't be able to do it for year, month and day.


2

Basically, the IF statement should have 3 parameters, 1st- Condition, 2nd- When condition true. 3rd- When Condition false. All three parameters separated by , I hope this below formula helps- IF(ISPICKVAL([Account].Status, 'Active'),[Account].Custom_Date__c + 20 , [Account].Custom_Date__c)


0

Well actually I've found a way doing it! Using -1 as the value for the value you want to be set equivalently to css "auto". e.g: IMAGE(url,"alt text", 100, -1) It will actually make the browser ignore this css setting and give it the default "auto" value.


1

You could also try a nested if statement IF(Color__c = 'Blue', Country__c = 'Germany', IF(Color__c = 'Red', Country__c = 'France'....etc But it looks like a case statement is the way to go.


1

if you just need a formula field then you can try this- CASE( Color__c , 'Red', 'France', 'Blue', 'Germany','Italy')


0

You can also do something like this RIGHT(TEXT(YEAR(NOW())), 2) to just take last 2 digits


0

You can use the Mod() to convert 4 digit year to 2 digits. DD/MM/YY TEXT(DAY(ExpectedDeliveryDate__c))+"/" +TEXT(MONTH(ExpectedDeliveryDate__c))+"/" +TEXT(MOD(YEAR(ExpectedDeliveryDate__c),100)) MM/DD/YY TEXT(MONTH(ExpectedDeliveryDate__c))+"/" +TEXT(DAY(ExpectedDeliveryDate__c))+"/" +TEXT(MOD(YEAR(ExpectedDeliveryDate__c),100))


1

The [ObjectName] syntax applies for Process builder formulas and according to the tags on your question, you are trying to build a workflow rule. Assuming that the workflow rule is being executed from ServiceAppointment object, then you can reference the merged fields directly in the formula like this: AND( NOT(ISBLANK(WorkTypeId)), CONTAINS( "Easy|...


0

I was able to get it to the point of not throwing an error on the missing ). I don't have your data model so it's hard for me to test further but this should get you going: EDITS HERE: IF( AND( Days_Since_Approval__c >= 180, OR(Claim_Line_Item__r.RecordType.Name = "Distributor Supplied Contractor", Claim_Line_Item__r.RecordType....


2

You will need to add the condition below. While checking for Commerce Cloud you can get rid of B2B Commerce Cloud from the title, using the SUBSTITUTE method. if(Contains([Contact].Title , "Marketing Cloud"), "Marketing Cloud;", "") + if(Contains(SUBSTITUTE([Contact].Title, "B2B Commerce Cloud", "") , "Commerce Cloud"), "Commerce Cloud;", "") + if(Contains(...


1

Editing this answer to reflect a better understanding of what you want to happen. I believe the ask is this: When verified complete, update to 'B' When ok for production, update to 'B+' When activated, update to 'A'. As mentioned by Derek, formula fields don't update anything; they're calculated dynamically every time that they are viewed, but no data is ...


0

I think that part of your confusion lies in what a formula field is. A formula field is something that is computed every time it is accessed from a persisted SObject (i.e. when you query this field via SOQL, or view the field on a Visualforce page, the field value is re-computed). There's nothing that needs to be "updated", it happens automatically. Let's ...


0

I have always needed to do ISBLANK() checks in any formulas that are used in process builder. Otherwise, there is a risk that a null reference error will kill the process. Notably, this includes the contents of any formula fields referenced in the process builder, not only the formulas directly defined in PB. Your cited error message isn't specifically a ...


2

Sure. It'll involve some custom fields and WF/PB. The number of those is dependent on how many stages you have. The general idea is that you have two custom date fields for each stage and workflow rules or a process builder that stamps the date when a stage is entered or left: Date Entered Stage A Date Left Stage A If your stages are linear (one is always ...


0

Yes, both triggers are running recursively, due to which you are not able to track any old value. Also, you can put recursive check in triggers, This will improve performance of system and you will see less delay in running your functionality. Instead of running those every time, put a check with a Boolean variable as below Apex class private static ...


0

I think you are trying to do a histogram for picklist values. I have done something similar with Status field on the Case Object. We use the case history object and we have history tracking enabled on the status field. We query the case history object for the record to create the status change by time. We are use the same dataset to create multiple ...


0

One approach that can be used recently is by using Custom Permissions. You can create custom permission, assign the permissions to the covered profiles and your Validation rule can be written from NOT(ISBLANK(PRIORVALUE(CloseDate)))&& ISCHANGED(CloseDate) && OR(Profile.name='Pname1',Profile.name='Pname',Profile.name='Pname3', and so on....) ...


1

Formula fields do not and cannot use Apex code. Formulas are written in a domain-specific expression language. Your Apex appears to be translatable into a formula. You'll need, from the formula reference, the IF() and AND() functions, and you'll need to reformat your comparisons and expressions according to the expectations of the formula language.


Top 50 recent answers are included