Acumatica 通过“创建时将数据传递给新记录”;添加新的“;针灸疗法
假设在屏幕SO301000上,我有一个PX选择器:Acumatica 通过“创建时将数据传递给新记录”;添加新的“;针灸疗法,acumatica,Acumatica,假设在屏幕SO301000上,我有一个PX选择器: namespace PX.Objects.SO { public class SOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder> { #region UsrOrderByContact [PXDBInt] [PXDefault(typeof(Contact),PersistingCheck=PXPersistingCheck.Nothing)]
namespace PX.Objects.SO
{
public class SOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder>
{
#region UsrOrderByContact
[PXDBInt]
[PXDefault(typeof(Contact),PersistingCheck=PXPersistingCheck.Nothing)]
[PXUIField(DisplayName="Ordered By")]
[PXSelector(
typeof(Search<Contact.contactID,
Where<Contact.bAccountID, Equal<Current<SOOrder.customerID>>,
And<Contact.contactType, Equal<ContactTypesAttribute.person>>>>),
new Type[]
{
typeof(Contact.lastName),
typeof(Contact.firstName),
typeof(Contact.phone1)
},
SubstituteKey = typeof(Contact.displayName)
)]
public virtual int? UsrOrderByContact { get; set; }
public abstract class usrOrderByContact : IBqlField { }
#endregion
}
}
名称空间PX.Objects.SO
{
公共类SOOrderExt:PXCacheExtension
{
#区域UsrOrderByContact
[PXDBInt]
[PXDefault(typeof(Contact),PersistingCheck=PXPersistingCheck.Nothing)]
[PXUIField(DisplayName=“Ordered By”)]
[PX选择器(
类型(搜索),
新类型[]
{
类型(联系人姓名),
类型(联系人姓名),
类型(联系电话1)
},
SubstituteKey=typeof(Contact.displayName)
)]
公共虚拟int?UsrOrderByContact{get;set;}
公共抽象类usrOrderByContact:IBqlField{}
#端区
}
}
和ASPX:
显示基于销售订单中当前客户的联系人列表
我想添加一个新联系人,所以我点击选择器旁边的铅笔图标,我在屏幕CR302000上得到一个新窗口
如何将当前SOOrder.CustomerID的值传递到屏幕CR302000上的Contact.BAccountID字段?允许的
功能(铅笔)是一个配置选项,不涉及编程。正因为如此,你不能让它做一些还不是现成行为的事情
因此,您必须删除AllowEdit
,并将其替换为普通的操作按钮。您可以设置按钮样式,使其仅显示铅笔图标。在事件处理程序中,您可以在重定向用户之前填充图形的字段:
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.RecordEdit]
public virtual IEnumerable EditContact(PXAdapter adapter)
{
bool createNewContact = [... false to open existing, true to create a new one...];
ContactMaint graph = PXGraph.CreateInstance<ContactMaint>();
if (createNewContact)
{
// Create new contact and initialize fields before redirecting
var newContact = (Contact)graph.Contact.Cache.CreateInstance();
newContact.BAccountID = [... SOOrder.CustomerID...];
graph.Contact.Current = newContact;
}
else
{
// If already selected, you want to redirect to the
// existing contact instead of creating a new one
graph.Contact.Current = graph.Contact.Search<Contact.contactID>([... current.ContactID ...]);
}
PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
return adapter.Get();
}
[PXButton(ImageKey=PX.Web.UI.Sprite.Main.RecordEdit]
公共虚拟IEnumerable EditContact(PXAdapter)
{
bool createNewContact=[…false打开现有联系人,true创建新联系人…];
ContactMaint graph=PXGraph.CreateInstance();
如果(createNewContact)
{
//在重定向之前创建新联系人并初始化字段
var newContact=(Contact)graph.Contact.Cache.CreateInstance();
newContact.BAccountID=[…SOOrder.CustomerID…];
graph.Contact.Current=新触点;
}
其他的
{
//如果已选择,则要重定向到
//现有联系人,而不是创建新联系人
graph.Contact.Current=graph.Contact.Search([…Current.ContactID…]);
}
pxrirecthelper.TryRedirect(图形,pxrirecthelper.WindowMode.NewWindow);
返回适配器Get();
}
这是关于AllowEdit在表单中显示为铅笔。据我所知,AllowedNew在选择器窗口中显示为加号无法自定义。