-1

I've been getting error on validating my formula to check if an option list has a certain value, and if any of the field has been changed, and I'm getting the error that it only received 1 parameter, I really lost there

IF(
   AND(
      ISPICKVAL(Status, 'Em Aprovação'), 
      OR(
         ISCHANGED(OrderNumber),
         ISCHANGED(Solicitante__c),
         ISCHANGED(MargemLiquida__c),
         ISCHANGED(TotalAmount),
         ISCHANGED(operacao__c),
         ISCHANGED(MargemBruta__c),
         ISCHANGED(CurrencyIsoCode),
         ISCHANGED(QuantidadeFaturadaTotal__c),
         ISCHANGED(Produto_do_pedido__c),
         ISCHANGED(EffectiveDate),
         ISCHANGED(ContaEntrega__c),
         ISCHANGED(RemessaIndustrializacao__c),
         ISCHANGED(FaturaParcial__c),
         ISCHANGED(PedidoCaronaBottega__c),
         ISCHANGED(SomatorioMargemBruta__c),
         ISCHANGED(SomatorioMargemLiquida__c),
         ISCHANGED(ContaFaturamento__c),
         ISCHANGED(ContaFaturamento__c),
         ISCHANGED(Aceita2Retalho__c),
         ISCHANGED(UnidadeMedida__c),
         ISCHANGED(PedidoCortesia__c),
         ISCHANGED(QuantidadeProdutos__c),
         ISCHANGED(PedidoCompra__c)
      ),
      True, 
      False
   )
),
1
  • I have formatted your formula according to best practice, which makes it easier to read and spot issues.
    – Derek F
    Commented Jan 5, 2023 at 16:23

1 Answer 1

0

It's easy to get lost in a sea of parenthesis. To help avoid that, the recommendation is that you treat formulas like code. One statement per line, and indent an additional level with each open parenthesis.

Doing so makes the issue here easy to spot. You've included the true, false) bit inside of your AND() instead of having it be the second and third parameters for the IF() function. You also have an extra comma at the end.

That said, you don't need the IF() at all here. IF(<condition>, true, false) can always be reduced to simply <condition>. Likewise, IF(<condition>, false, true) can always be reduced to simply NOT(<condition>)

Your formula here just needs to be

AND(
    ISPICKVAL(Status, 'Em Aprovação'), 
    OR(
      <your collection of field change checks here>
    )
)
1
  • Alternatively, this gives me the feeling that you're pretty much trying to recreate an Approval Process
    – Derek F
    Commented Jan 5, 2023 at 16:28

You must log in to answer this question.

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