SugarCRM计算字段,访问一对多相关模块中的字段(SugarCRM calculated field, accessing field in one

编程入门 行业动态 更新时间:2024-10-26 16:35:23
SugarCRM计算字段,访问一对多相关模块中的字段(SugarCRM calculated field, accessing field in one-to-many related module)

SugarCRM有一个很棒的功能,允许引用相关模块中的字段来自动填充主模块中的字段。 但是,我无法明确地确定为什么我可以在一个模块中工作,而不是另一个模块。 我怀疑,但如果我是对的,我必须找到另一种方法来完成同样的事情。

这是在我们自己的服务器上托管的SugarCRM Professional,6.4.2。

什么有用

使用两个默认模块(Contacts,Opportunities):我可以使用以下公式使Opportunities.name成为引用Contacts中两个字段的计算字段:

concat(related($contacts, "last_name"), ", ",related($contacts, "first_name")," - ", getDropdownValue("timeline_options", $timeline_interest_c))

什么行不通

使用一个自定义模块(应用程序,在Module Builder中创建并从Module Builder部署)和一个默认模块(Contacts):我无法使用以下公式使Applications.name正确引用Contacts中的相同两个字段:

concat(related($contacts, "last_name"), ", ",related($contacts, "first_name")," - ", getDropdownValue("timeline_options", $timeline_choice))

我想念的是什么?

显然,在这两种情况下不同的是关系的类型。 我不明白的是这种不同关系的技术含义。 换句话说,为什么机会模块在应用程序模块没有时知道$contacts ?

是吗...

“多对多”与“一对多”关系如何存储的本质? 要么, 事实上,在第一种情况下,计算字段位于关系的“主要模块”中,而在第二种情况下,计算字段位于关系的“次要模块”中? 要么, 完全不同的东西?

这个问题的答案可能暗示我可能会尝试不同的方式,以实现我想要的。

更新......什么仍然无效

自从最初提交这个问题以来,我已经尝试了更多的东西。

我重新创建了一对多关系,以便Applications是主要模块而Contacts是辅助模块 ,但无济于事。 发生同样的错误。 这告诉我上面的#2不是问题。 我尝试了一个不同的公式,从Opportunities访问一个字段,该字段与Applications有一对一的关系 。 发生同样的错误,这次告诉我“未知领域:机会”。 这告诉我,不一定是“一对多”的关系造成了上面#1中的问题,但也许不是“多对多”的关系。

期望的答案有两个部分

我想了解不同行为的原因 ,我也想知道访问相关模块中字段的最佳方法 (在“一对多”的“一”侧)以便自动填充我的新模块中的计算字段(在“一对多”的“许多”方面)。

我要提前谢谢!

SugarCRM has a great feature that allows referencing fields in related modules to auto-populate fields in the primary module. However, I haven't been able to definitively determine why I can make it work in one module, but not another. I have a suspicion, but if I'm right, I have to find another way to accomplish the same thing.

This is for SugarCRM Professional, 6.4.2, hosted on our own servers.

What Works

Using two default modules (Contacts, Opportunities): I am able to make Opportunities.name a calculated field that references two fields from Contacts, using the following formula:

concat(related($contacts, "last_name"), ", ",related($contacts, "first_name")," - ", getDropdownValue("timeline_options", $timeline_interest_c))

What Doesn't Work

Using one custom module (Applications, created in and deployed from Module Builder) and one default module (Contacts): I am not able to make Applications.name correctly reference the same two fields from Contacts, using the following formula:

concat(related($contacts, "last_name"), ", ",related($contacts, "first_name")," - ", getDropdownValue("timeline_options", $timeline_choice))

What Am I Missing?

Obviously, the thing that is different in these two scenarios is the type of relationship. What I don't understand is the technical implications of that different relationship. In other words, why does the Opportunities module know about $contacts when the Applications module doesn't?

Is it...

the nature of how "many-to-many" vs. "one-to-many" relationships are stored? or, the fact that in the first instance, the calculated field resides in the "primary module" of the relationship, while in the second instance, the calculated field resides in the "secondary module" of the relationship? or, something else entirely?

The answer to this question may suggest what I might try differently in order to accomplish what I want.

Update... What Still Doesn't Work

Since originally submitting this question, I've tried a couple more things.

I recreated the one-to-many relationship so that Applications is the primary module and Contacts is the secondary module, to no avail. The same error occurs. This tells me that #2 from above is not the problem. I attempted a different formula, accessing a field from Opportunities, which has a one-to-one relationship with Applications. The same error occurs, this time telling me "Unknown field: opportunities". This tells me that it isn't necessarily the "one-to-many" relationship that's causing problems as in #1 above, but perhaps the fact that it isn't a "many-to-many" relationship.

Desired Answer Has Two Parts

I want to understand the reason for the different behaviour, and I also want to know the best way to access fields in a related module (on the "one" side of "one-to-many") in order to auto-populate a calculated field in my new module (on the "many" side of "one-to-many").

My thanks, in advance!

最满意答案

问题似乎是$contact不是链接的实际名称,但链接可能被命名为其他名称。 您可以在Studio / MB中找到链接的名称,也可以直接查看元数据文件,该文件存储在cache/modules/YOURMODULENAME/YOURMODULENAMEvardefs.php 。 元数据文件是权威来源 - 它是SugarCRM如何查看对象的字段,包括链接,因此链接也应该在那里,并且那里指定的名称应该有用。

The problem seems to be that $contact is not the actual name of the link, but the link may be named something else. You can find the name of the link in Studio/MB or by looking directly into the metadata file, which is stored at cache/modules/YOURMODULENAME/YOURMODULENAMEvardefs.php. The metadata file is the authoritative source - it is how SugarCRM views the fields of the object, including the links, so that link should be there too, and the name specified there should work.

更多推荐

本文发布于:2023-08-07 08:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463324.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多相   字段   模块   SugarCRM   field

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!