function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jmckjmck 

Using "IF" and "ISBLANK" in Custom Button URL

Can you use logical functions in combination with a custom URL  in a custom button?  I would like for the formula to evaluate whether or not a field is blank and utilize one custom URL if it is and another if not.  The URLs work by themselves, but fail when I try to combine them with the logical functions.

 

{!

IF(ISBLANK(Account.Parent),

 

"/001/e?acc3={!Account.Name}&CF00N40000002GuGT={!Account.Name}&
RecordType=01240000000M4W4&ent=Account",

 

"/001/e?acc3={!Account.Name}&CF00N40000002GuGT={!Account.Parent}&
RecordType=01240000000M4W4&ent=Account")

}

Jan VandeveldeJan Vandevelde
choose button behaviour execute javascript.
Then put in the following:

 var loc;

if(
"{!Account.Parent}" == ""
){
loc = "/001/e?acc3={!Account.Name}&CF00N40000002GuGT={!Account.Name}&
RecordType=01240000000M4W4&ent=Account";
}
else{
loc = "/001/e?acc3={!Account.Name}&CF00N40000002GuGT={!Account.Parent}&
RecordType=01240000000M4W4&ent=Account";
}

window.top.location.href = loc;


I think this should work for you.