+ Start a Discussion
jisaacjisaac 

If statements, And Statements and Or Statements with ISPickval help with Field update

I know there is a way to write this and I am just stumped.

I need to update a percentage field as follows:

If the pickval field Business Unit equals X or Y and the pickval field Implementation Type is In-House, then the Rev Rec percent should be 54. If the implementation Type is ASP, the Rev Rec percentage is 0.

If the Business Unit is W or Z and the Implementation Type is In-House, the the Rev Rec percent is 85. If the Implementation Type is ASP, the percentage is zero.

Can someone help me muddle through the and, or and if statements to make this work?

Thanks for any help I can get!
Jane



jvolkovjvolkov
One solution would be a workflow rule that triggers a field update.
 
It would look something like this.
 
(Object: Business Unit equals X, Y) and (Object: Implementation Type: equals In-House)
 
 

This should trigger a field update that updates the field Rev Rec with the number 54.

Then create a second workflow rule and field update to have the field update to the varous desired values.

If you have someone familiar with Java or Apex at your office you can also try asking them to deploy an Apex code that does all this for you.

jisaacjisaac
Thanks jvolkov,

but that's what I have today. I was trying to collapse the number of workflow rules and field updates into one by using the ISPICKVAL, AND and OR functions and do it all within one Field Update and one Workflow rule.

I do not have java and APEX knowledge, unfortuately and our IT folks have their hands full trying to get the backoffice Peoplesoft things working right.

Jane
TCAdminTCAdmin
Hello jisaac,

The easiest way to do this would be if you can assign a specific value to each field and each value in that field. You can then utilize a CASE() statement for each field and simply add them together.
Code:
CASE(Picklist1__c,
'value1', 0.1,
'value2', 0.2,
'value3', 0.3,
'value4', 0.4,
0.5) +

CASE(Picklist2__c,
'1val', 0.25,
0.5)

 Your other option is to create a specific value for each possible combination. This would appear similar to this.
Code:
IF(
  AND(
    ISPICKVAL(Picklist1__c, ''),
    ISPICKVAL(Picklist2__c, '')
  ),
  0.0,
  IF(
    AND(
      ISPICKVAL(Picklist1__c, 'value1'),
      ISPICKVAL(Picklist2__c, '1val')
    ),
    0.35,
    // remainder
  )
)

As you can see the second option would become oversized quickly.
jvolkovjvolkov
It would look something like this.
 
IF(
 
 AND(
 
   OR( 
      ISPICKVAL(Business_Unit__c,"X"),
      ISPICKVAL(Business_Unit__c,"Y")
   ),
 
 ISPICKVAL(Implementation_Type__c, "In-House")
 
 ),
54,
 
  AND(
 
     OR( 
        ISPICKVAL(Business_Unit__c,"X"),
        ISPICKVAL(Business_Unit__c,"Y")
     ),
 
   ISPICKVAL(Implementation_Type__c, "In-House")
 
  ),
 0,
 
    AND(
 
       OR( 
          ISPICKVAL(Business_Unit__c,"W"),
          ISPICKVAL(Business_Unit__c,"Z")
       ),
 
     ISPICKVAL(Implementation_Type__c, "ASP")
 
    ),
   85,
 
0
)
jvolkovjvolkov
not sure why it replaced 0 with smiley faces, anyway the other post looks better anyways
TCAdminTCAdmin
jvolkov,

When posting any code to the boards it is recommended to utilize the SRC button at the top of the box. This prevents it from messing with it. The only issue I have found is that it doesn't like question marks and you will have to go back in and put those back in after adding the code to your post.