【发布时间】:2021-05-18 14:30:04
【问题描述】:
我在商机定制部门工作。我有自定义按钮,我想根据用户的操作重复使用。
第一次通过时,如果他们点击按钮,我会在 Google Drive 中创建一个文件夹。
如果已经完成,当他们单击按钮时,我将在新的浏览器窗口中打开之前创建的 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 Drive 中创建文件夹返回时更改标签显示(尽管我再次更改 ExternalRef 的值,所以也许可以在该字段的更改属性委托中处理?IDK。)
【问题讨论】:
标签: c# customization acumatica