将数据从业务机会复制到相关自定义对象的自定义按钮 [英] Custom Button to copy data from Opportunity into a related custom object

查看:32
本文介绍了将数据从业务机会复制到相关自定义对象的自定义按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义对象,用于映射到机会的产品设置.这是一对多的关系 - 一个机会映射到多个设置对象,但一个设置对象仅映射到一个机会.

I have a custom object that is used for product setup that is mapped to an opportunity. It's a one to many relationship - one opportunity maps to many setup objects, but one setup object is only mapped to one opportunity.

Opportunity 有一些设置字段需要作为相关自定义对象的默认值.不幸的是,我不能只在公式中指定它们 - 出现错误.

Opportunity has some setup fields that need to act as defaults for the related custom object. Unfortunately, I cannot just specify them in a formula - getting an error.

我想要做的是有一个自定义按钮,允许用户单击并将所有相关设置字段从机会中复制到自定义设置对象中,然后根据需要对其进行编辑.

What I would like to do is have a custom button that would allow user to click and copy all of the related setup fields from the opportunity into the custom setup object and then edit them as needed.

非常感谢任何指针或示例代码!

Any pointers or sample code are greatly appreciated!

推荐答案

您可以使用机会详细信息页面上自定义对象的相关列表上的自定义按钮来实现此目的.

You can achieve this with a custom button on the related list for your custom object on the opportunity detail page.

标准 Salesforce 新建/编辑屏幕上的所有字段都有与之关联的 ID.您可以通过使用这些 id 在您的 URL 上设置 GET 参数来指定字段的值.例如,如果您的商机名称字段中的 ID 为opp3",则以下 URL 将填充您的新商机页面上的名称字段:

All of the fields on a standard Salesforce new/edit screen have id's associated with them. You can specify values for fields by using these ids to set GET parameters on your URL. For example if the id on the name field on your opportunity is 'opp3', the following URL will populate the name field on your new opportunity page:

https://na2.salesforce.com/006/e?opp3=Hello+World

您必须将 na2 更改为您组织的正确服务器.

You would have to change na2 to the correct server for your org.

新记录页面 URL 包含特定对象的 3 个字符 ID 前缀,然后是/e".006 是机会的前缀.您将不得不尝试创建一个新记录,以查看自定义对象的 3 个字符是什么.

The new record page URL contains the 3 character id prefix for your particular object and then '/e'. 006 is the prefix for opportunities. You will have to attempt to create a new record to see what the 3 characters are for your custom object.

您必须捕获要在自定义对象上填充的字段的 ID.您可以通过查看新记录页面的来源来执行此操作.对于自定义字段,这些 ID 将采用 Salesforce ID 的形式(例如 00N40000002QhEV).

You will have to capture the id's of the fields you want to populate on your custom object. You can do this by viewing the source of the new record page. For custom fields these id's will take the form of a Salesforce Id (eg. 00N40000002QhEV).

在您的自定义对象上创建一个新的列表按钮,并将行为设置为没有标题和侧边栏,并将源设置为 URL.使用 id=value 对建立您的 URL,以&"分隔使用您从页面源中获得的 id 和插入字段功能来选择您希望添加的机会字段.您应该得到如下结果:

Create a new list button on your custom object and set the behavior to without header and sidebar and set the source to URL. Build up your URL with id=value pairs separated by '&' using the id you got from the page source and the insert field functionality to select the opportunity fields your wish to add in. You should end up with something like this:

/a0U/e?00N40000002QhEV={!Opportunity.Name}&00N40000002QhEW={!Opportunity.StageName}

a0U 应替换为自定义对象的正确前缀.然后将您的按钮添加到机会下自定义对象的相关列表中.

a0U should be replaced by the correct prefix for your custom object. Then add your button to the related list for your custom object under opportunity.

这篇关于将数据从业务机会复制到相关自定义对象的自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆