0

I have a URL hack which works fine, but I now need to insert an IF statement in to check for a null condition and use another field if so. What am I doing wrong here?

/500/e?
CF00NO00000029qLz={!Order.OrderNumber}
&CF00NO00000029qLz_lkid={!Order.Id}
&retURL={!Order.Id}
&RecordType=012O00000009PQf
&ent=Case
&cas4={!Account.Name}
&cas3={!IF({!Order.Therapist__c}=NULL,{!Order.CustomerAuthorizedBy},
{!Order.Therapist__c})}
&CF00NO0000002MGH0={!Order.EndUser__c}
&00NO00000029qMO=Customer
&00NO00000029qr2=1
  • do not use hardcoded ids – Santanu Boral Mar 20 '17 at 4:34
  • Where exactly are you using this code? VF page or custom button? – Salesforcesmarty Mar 20 '17 at 4:35
  • This is on a custom button - I need to populate a new Case from an Order, but can't save it at this stage as there are other fields to be entered first, that are required. – Irene Mar 20 '17 at 4:37
1

Simply use BLANKVALUE function like this below in code :

BLANKVAUE: Determines if an expression has a value and returns a substitute expression if it does not. If the expression has a value, returns the value of the expression.

/500/e?
CF00NO00000029qLz={!Order.OrderNumber}
&CF00NO00000029qLz_lkid={!Order.Id}
&retURL={!Order.Id}
&RecordType={!$Setup.CustomSettingName__c.CustomFieldName__c}
&ent=Case
&cas4={!Account.Name}
&cas3={!BLANKVALUE(Order.Therapist__c,Order.CustomerAuthorizedBy)}
&CF00NO0000002MGH0={!Order.EndUser__c}
&00NO00000029qMO=Customer
&00NO00000029qr2=1

Also, do not hardcode recordtype ids.

Rather create a Hierarchy Custom Setting and access the value like this

RecordType =  {!$Setup.CustomSettingName__c.CustomFieldName__c}
0

Pretty sure you just need to add in a couple of quotes to make the value being tested a string parameter to the IF():

IF("{!Order.Therapist__c}"=NULL,"{!Order.CustomerAuthorizedBy}",
  • 2
    should only need one ! in expression, no? – cropredy Mar 20 '17 at 5:57
  • @cropredy Yep, good spot! – Matt Lacey Mar 20 '17 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.