When user created a new main account or modified an existing main account, that particular main account should automatically suspend field should be marked until workflow gets approved.
[ExtensionOf(formDataSourceStr(MainAccount,DimensionAttributeValue))]
final class TPO_DimensionAttributeDS_Extension
{
public edit Suspended dimensionAttributeValueIsSuspended(boolean set, DimensionAttributeValue dimensionAttributeValue, Suspended isSuspended)
{
TPO_MainAccountWFApprovalStatus _status;
next dimensionAttributeValueIsSuspended(set, dimensionAttributeValue, isSuspended);
_dimensionAttributeValue.IsSuspended = NoYes::Yes;
if(_dimensionAttributeValue.IsSuspended == NoYes::Yes && _status == TPO_MainAccountWFApprovalStatus::Approved)
{
_dimensionAttributeValue.IsSuspended = NoYes::No;
dimensionAttributeValue.IsSuspended = isSuspended;
}
return _isSuspended;
}
}
I did try this code but it isn’t working.
You didn’t explain your problem (it isn’t working is not an explanation) and there are many bugs in your code, but let’s not go to details, because the overall approach is wrong. If you want to change the value when creating or updating a record, use insert() (and/or initValue()) and update() methods of the table.
okay!The record I have to update is a data edit method(IsSuspended) when the workflow status is approved, it has to be No.(unmarked). So if I write update/insert method where can I write it?
Asking when where to write code if you write it in update() method doesn’t make a good sense to me, because the condition already defines the answer.
Maybe you rather meant what logic you need. The edit method returns the value of DimensionAttributeValue.IsSuspended field, therefore you want to set this field to Yes on create and update, and set it to No on approval.
yes exactly! So which method should I write and where should I write the logic, in form data field extension or for data source.