我在合约上创建了一个自定义操作,用于更新描述和属性。
在单次输入并按下操作按钮时工作正常,但在“质量操作”期间,仅更新描述并保存属性。
在群众行动期间,我需要做什么才能正确保存属性值?
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();
}
答案 0 :(得分:0)
无需声明自定义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();
}
}