I am relatively new to salesforce and administration. I am trying to create a custom cloning button that checks against the user profile name.

I am using URL as content source.

if({$Profile.Name}="System Administrator") {

1 Answer 1


You are nearly there. Try this:

if('{!$Profile.Name}'=='System Administrator') {
    window.location = '/{!Opportunity.Id}/e?clone=1';

Note the differences

  • I am using the salesforce token evaluation syntax {!} around the !Profile.Name var. If you don't do this, it won't be evaluated by Salesforce.
  • Also, I have enclosed that whole expression in quotes - we are comparing strings.
  • Finally, I am using Javascript to redirect, so you need to use the window.location command to redirect.

This is tested and works for an onclick Javascript button.

  • If this worked for you, you can mark as accepted. Apr 22, 2015 at 22:13
  • @casper I tried the above but the button is taking me to e/?clone=1
    – C0DEPirate
    Nov 5, 2015 at 12:05
  • Check that you are in the opportunity context. Also check that you have correctly quoted the string. You can paste code snippet in a comment here if you like. Nov 5, 2015 at 20:58

You must log in to answer this question.

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