1

I'm trying to trigger a workflow rule over several criteria including a check against related objects (Line items) record type names. The idea is that if this all evaluates to true, it will trigger a workflow to set the claim header status to "Expired".

I've written the following formula;

IF(AND(ISCHANGED(Days_Since_Approval__c)
     && Days_Since_Approval__c >= 180,
     NOT(ISPICKVAL(Status, "Rejected")
 ||ISPICKVAL(Status, "Request Claim Closure")
 ||ISPICKVAL(Status, "Closed and Permitted to Invoice") 
 ||ISPICKVAL(Status, "No Further Action")
 ||ISPICKVAL(Status, "Closed"),
     (Claim_Line_Item__r.RecordType.Name = "Distributor Supplied Contractor"
 || "Distributor Supplied Labour" 
 || "Distributor Supplied Parts")
        )
    )
 )

It says I'm missing a bracket but I can't see where I've gone wrong, or perhaps it is wrong on multiple levels, or maybe a simpler method I'm overlooking? Any insight is much appreciated.

1 Answer 1

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.Name = "Distributor Supplied Labour"),
        OR(NOT(ISPICKVAL(Status, "Rejected")), NOT(ISPICKVAL(Status, "Some Other"))) 
    ),
    true, 
    false
) 

When I run into issues like this on complexity, I restart with the basic formula:

IF(1 = 1, true, false)

Then add in each layer of complexity without OR conditions

IF(Days_Since_Approval__c >= 180, true, false)

Keep iterating on each step of the formula until you are at your end result, testing small chunks as you go. At first it seems monotonous, but you'll figure out where you're going wrong more quickly.

4
  • Hi Brandon, thanks for the reply, the only thing here is I'm trying to evaluate each parameter as true in the logical IF AND, which should give a global TRUE which will then fire the workflow rule. It looks like this formula is using the latter parameters as values true/false for the IF statement? Or am I reading this wrong Jan 29, 2020 at 14:18
  • Hey Lawrence, could you write in prose the exact params you are checking for and give a positive and negative result for me? The business case escapes me a bit on this one, sorry! We'll get it figured out. is it: "if days since approval is changed and greater than 180 days, and the status is not one of the following: rejected, req, etc., and the record type name is distributor supplied or labour, or parts, then return true." Jan 29, 2020 at 15:23
  • Hi Brandon - Yes, the days since approval ISCHANGED(counter was just to have to workflow evaluate daily, but I've since realized this won't be necessary. We have a counter on the case object which counts the days since a claim was in the approved status. Once this hits 180days, I'd like a workflow rule to fire which will update the case header to expired, due to the nature of this business case, it must only update to expired if the additional criteria in the formula are also true i.e. the Case cannot be and must never have been in the outlined statuses, and must have related lines detailed Jan 29, 2020 at 16:06
  • Laurence, try this out I think it will get you where you need to go: IF( AND( Days_Since_Approval__c >= 180, OR(Claim_Line_Item__r.RecordType.Name = "Distributor Supplied Contractor", Claim_Line_Item__r.RecordType.Name = "Distributor Supplied Labour"), OR(NOT(ISPICKVAL(Status, "Rejected")), NOT(ISPICKVAL(Status, "Some Other"))) ), true, false ) I will update my answer, please mark if it works out - or update me if not. Jan 29, 2020 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .