Base.Actions.PressSave() 不适用于具有质量操作的属性
Base.Actions.PressSave() not working on Attributes with mass actions
我创建了一个更新描述和属性的合同自定义操作。
在执行单个条目并按下操作按钮时它工作正常,但在大规模操作期间仅更新描述并保存属性而不是。
我需要做什么才能在 Mass Action 期间正确保存属性值?
public PXSelect<CSAnswers,
Where<CSAnswers.refNoteID, Equal<Current<Contract.noteID>>>> CSAttr;
protected IEnumerable testAction(PXAdapter adapter)
{
//get the activation parameters
var a = CSAttr.Select();
Contract mycontract = Base.CurrentContract.Select();
foreach (CSAnswers item in a.ToList())
{
if (item.AttributeID == "ACTA")
{
item.Value = "Won't Update1";
CSAttr.Update(item); //shouldn't this update?
}
else if (item.AttributeID == "ACTB") //desired mode set by user
{
item.Value = "Won't Update2";
CSAttr.Update(item); //shouldn't this update?
}
}
mycontract.Description = "This Works Fine";
Base.CurrentContract.Update(mycontract);
Base.Actions.PressSave();
return adapter.Get();
}
无需声明自定义 CSAttr 数据视图:ContractMaint 已包含 Answers 数据视图以使用属性。
如下实施的 TestAction,当从设置为入口点列表的 GI 启动时,成功更新全新 6.00.1596 Acumatica ERP 实例上的合同描述和属性值:
public class ContractMaintExt : PXGraphExtension<ContractMaint>
{
public override void Initialize()
{
TestAction.IsMass = true;
}
public PXAction<Contract> TestAction;
[PXButton]
[PXUIField(DisplayName = "Test Action")]
public void testAction()
{
Contract mycontract = Base.CurrentContract.Select();
foreach (CSAnswers attr in Base.Answers.Select())
{
if (attr.AttributeID == "CONFIGURAB")
{
attr.Value = "Updated";
Base.Answers.Update(attr); //shouldn't this update?
}
}
mycontract.Description = "This Works Fine";
Base.Contracts.Update(mycontract);
Base.Actions.PressSave();
}
}
我创建了一个更新描述和属性的合同自定义操作。
在执行单个条目并按下操作按钮时它工作正常,但在大规模操作期间仅更新描述并保存属性而不是。
我需要做什么才能在 Mass Action 期间正确保存属性值?
public PXSelect<CSAnswers,
Where<CSAnswers.refNoteID, Equal<Current<Contract.noteID>>>> CSAttr;
protected IEnumerable testAction(PXAdapter adapter)
{
//get the activation parameters
var a = CSAttr.Select();
Contract mycontract = Base.CurrentContract.Select();
foreach (CSAnswers item in a.ToList())
{
if (item.AttributeID == "ACTA")
{
item.Value = "Won't Update1";
CSAttr.Update(item); //shouldn't this update?
}
else if (item.AttributeID == "ACTB") //desired mode set by user
{
item.Value = "Won't Update2";
CSAttr.Update(item); //shouldn't this update?
}
}
mycontract.Description = "This Works Fine";
Base.CurrentContract.Update(mycontract);
Base.Actions.PressSave();
return adapter.Get();
}
无需声明自定义 CSAttr 数据视图:ContractMaint 已包含 Answers 数据视图以使用属性。
如下实施的 TestAction,当从设置为入口点列表的 GI 启动时,成功更新全新 6.00.1596 Acumatica ERP 实例上的合同描述和属性值:
public class ContractMaintExt : PXGraphExtension<ContractMaint>
{
public override void Initialize()
{
TestAction.IsMass = true;
}
public PXAction<Contract> TestAction;
[PXButton]
[PXUIField(DisplayName = "Test Action")]
public void testAction()
{
Contract mycontract = Base.CurrentContract.Select();
foreach (CSAnswers attr in Base.Answers.Select())
{
if (attr.AttributeID == "CONFIGURAB")
{
attr.Value = "Updated";
Base.Answers.Update(attr); //shouldn't this update?
}
}
mycontract.Description = "This Works Fine";
Base.Contracts.Update(mycontract);
Base.Actions.PressSave();
}
}