You need to sign in to do that
Don't have an account?

Custom Button on Custom Object Not Working
Hi All,
I have created a Custom Object within my Org, and I would like to have a Custom Button which, depending on the User's Role, will take them to one of three Report Folders, to view a selection of reports related to this Object.
I have used the following foruma, which saves without a problem, and when you check the Syntax returns no errors:
if ( {!$UserRole.Name} = "Central TM" || "Eastern TM" || "Ireland TM" || "Northern TM" || "South Central TM" || "South East TM" || "South West TM", "https://emea.salesforce.com/00l20000001nVUx", if ( {!$UserRole.Name} = "Central RBM" || "Eastern RBM" || "Ireland RBM" || "Northern RBM" || "South Central RBM" || "South East RBM" || "South West RBM", "https://emea.salesforce.com/00l20000001nVUs", "https://emea.salesforce.com/00l20000001nVV2" ))
However, whenever I test the code it does not work - it comes back with an error message:
"URL No Longer Exists"
Moreover, if I copy+paste any one of the 3 URLs I have used in the above formula, it takes me to exactly the right place, so I know that the URLs are fine.
Can anyone let me know what is going wrong please?
Additionally (just a by-the-by if anyone can help), I can only seem to show this custom button within one of the List Views (which has to be selected after a user has navigated to my Custom Object tab) - is there any way for the button to be visible as soon as a user clicks on the Custom Object tab, without them having to select a List View first?
Thank you for any help you can provide,
Andy
All Answers
Just to follow-up on this... when I say "When I test the code" what I mean is, "When I click on the button" to take me to a report folder, it does not work...
Apologies for the confusion.
Andy
Just another update - after some more online research it seemed that using the Javascript method was the way forward - so I created the following:
However, this is coming up with the same error.
I'm completely new to JS, so this could all be wrong - any thought?
Thanks again,
Andy
Just in case it helps, whenever I click the button at the moment, the link in the address bar of the browser window always shows "https://emea.salesforce.com/undefined" but I'm still not sure what is causing the error.
Thanks,
Andy
Correct javascript button code
Thanks,
bForce
Hi b-Force,
Thank you very much indeed for helping me with this.
I have copy+pasted your code, and tried my button again, but am getting the following error:
Can you help me to identify where I need to add this parenthesis?
Thanks,
Andy
This works perfectly!
Thank you b-Force, much appreciated.
Nice to heard that, It works for you.
Happy coding.
Thanks,
bForce