简体   繁体   English

在 AX 中创建特定于公司的下拉菜单

[英]Create a dropdown menu specific for company in AX

I would like to create a dropdown in AX form so that only the user from specific company see this field as a dropdown and other company see it as string field that user have to manually key in. I only manage to create the dropdown list based on table menu, but have no idea how to limit to specific company.我想在 AX 表单中创建一个下拉列表,以便只有来自特定公司的用户将此字段视为下拉列表,而其他公司将其视为用户必须手动键入的字符串字段。我只设法基于创建下拉列表表菜单,但不知道如何限制特定公司。

This create a problem since not all company wants dropdown and If the user key in none registered number, the system will return “ the value xxx in the field yyy is not found in the relating table zzz这会产生一个问题,因为并非所有公司都想要下拉菜单,如果用户键入无注册号码,系统将返回“在相关表 zzz 中找不到字段 yyy 中的值 xxx

How can I set the condition so that only selected company see this field as dropdown and the other company see this as string?如何设置条件,以便只有选定的公司将此字段视为下拉列表,而其他公司将此字段视为字符串? And also where to locate the condition?还有在哪里找到条件?

You may need to set the form control property AutoDeclaration=Yes and then dynamically change the FormStringControl.LookupButton ( see here ) based on the current company ( curext() ).您可能需要设置表单控件属性AutoDeclaration=Yes ,然后根据当前公司 ( curext() ) 动态更改FormStringControl.LookupButton ( 请参见此处)。

在此处输入图像描述

You must also decide if you have a relation on your table, whether or not you want it to be enforced ( Validate=[Yes/No] ).您还必须决定您的表上是否有关系,是否希望它被强制执行( Validate=[Yes/No] )。 If you are allowing a free-text field input, I would imagine you would want No , but you could perform validation in the validateField or validateWrite method.如果您允许自由文本字段输入,我想您会想要No ,但您可以在validateFieldvalidateWrite方法中执行验证。

Depending on your situation, you may want to create a custom lookup with a condition.根据您的情况,您可能希望创建带有条件的自定义lookup

See how to create custom lookups here - https://docs.microsoft.com/en-us/dynamicsax-2012/developer/how-to-add-a-lookup-form-to-a-control在此处查看如何创建自定义查找 - https://docs.microsoft.com/en-us/dynamicsax-2012/developer/how-to-add-a-lookup-form-to-a-control

You'll have to experiment a little, but this information should point you the right direction.您必须进行一些实验,但这些信息应该为您指明正确的方向。

You could add two fields to your form, on with the lookup and one without.您可以在表单中添加两个字段,使用查找,一个不使用。 You could then use the security setup to control which users have access to which field.然后,您可以使用安全设置来控制哪些用户可以访问哪个字段。 Note that this may not work if you have users that work in both companies that use the field with lookup and companies that use the field without lookup.请注意,如果您的用户同时在使用该字段进行查找的公司和使用该字段但不进行查找的公司工作,这可能不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM