我的工作是机会定制。我有自定义按钮,我想重用取决于用户正在做什么。
第一次,如果他们点击按钮,我将创建一个文件夹在谷歌驱动器。
如果已经这样做了,当他们单击按钮时,我将打开以前在新浏览器窗口中创建的GDrive文件夹。为了知道要采取哪些操作,我使用了ExternalRef字段。
我希望按钮的显示名称显示当用户单击它时会发生什么,这样他们就知道期望什么了。
但是,我不能在委托中更改显示名称,也无法看到如何在初始化时更改该值。
我想我需要为此建立一个函数?但是,从示例中还不清楚如何做到这一点,而且我无法在培训课程中找到描述的用例。
下面是我的自定义按钮的委托存根:
public PXAction<CROpportunity> OpportunityInGDRIVE;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "SETUP QUOTE", MapEnableRights = PXCacheRights.Select)]
public virtual void opportunityInGDRIVE()
{
// I can VIEW the caption, but cannot SET it
var _Caption = OpportunityInGDRIVE.GetCaption();
if (Base.Opportunity.Current.ExternalRef.ToUpper().Contains("GDRIVE"))
{
// GOOGLE API info gets inserted here...
// I WANT to SET Caption here, but not allowed
Base.Opportunity.Current.ExternalRef = "GDRIVE";
Base.Opportunity.UpdateCurrent();
}
else
{
// send to google drive... this is a place holder
var redirectException =
new PXRedirectToUrlException("https://www.cepro.com/wp-content/uploads/2019/04/BuildersNoSmartHomes_large-1100x650.jpg",
PXBaseRedirectException.WindowMode.New, "Acumatica.com");
throw redirectException;
}
}所以,我需要知道如何:
( A)根据ExternalRef的初始值更改初始化中的标签显示
( B)当我在Google中创建文件夹时,更改标签显示(尽管我再次更改了ExternalRef的值,所以可能可以在该字段的Change属性委托中处理吗?)(闲谈)
发布于 2021-02-15 18:30:06
您可以在RowSelected事件处理程序的CROpportunity (主DAC)中设置标题。
public virtual void _(Events.RowSelected<CROpportunity> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
CROpportunity row = e.Row;
if (row == null) return;
this.OpportunityInGDRIVE.SetCaption((Base.Opportunity.Current.ExternalRef.ToUpper().Contains("GDRIVE")) ? "GDRIVE" : "DROPBOX");
}https://stackoverflow.com/questions/66212509
复制相似问题