最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

salesforce - How do I grab the current page URL and place it into a new URL reference in JavaScript? - Stack Overflow

programmeradmin3浏览0评论

Here's what I'm using as a custom button control in Salesforce that executes JavaScript.

    location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p7=GetURLHere&p2_lkid={!Case.ContactId}&template_id=00Xc0000000HrOk');

The GetURLHere part is where I'd like to grab the current URL and place it on the next page.

This form works like Select Listview > Click Button > New page loads with the previous pages URL in the p7 field.

p7represents a field I'd like to put it into upon page load.

The usual document.location.hrefdoesn't want to work in this control.

Any idea on how to do this in the Force environment?

Here's what I'm using as a custom button control in Salesforce that executes JavaScript.

    location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p7=GetURLHere&p2_lkid={!Case.ContactId}&template_id=00Xc0000000HrOk');

The GetURLHere part is where I'd like to grab the current URL and place it on the next page.

This form works like Select Listview > Click Button > New page loads with the previous pages URL in the p7 field.

p7represents a field I'd like to put it into upon page load.

The usual document.location.hrefdoesn't want to work in this control.

Any idea on how to do this in the Force. environment?

Share Improve this question edited May 14, 2012 at 19:17 Command-Z asked May 13, 2012 at 1:25 Command-ZCommand-Z 131 silver badge5 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You should be able to use the $CurrentPage object to get the current pages url as a formula expression.

document.location.href = '{!$CurrentPage.URL}';

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论