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

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

问题描述

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

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 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',则以下网址将填充新商机页面上的名称字段:

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对构建网址使用从页面源获得的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天全站免登陆