I had created the custom workflow but now when the submitter submits the workflow the approver is unable to open it but he is receiving an exception Buffer for call of BankReconciliation is not specified. See the code below
/// <summary>
/// The MyWorkflowTypeSubmitManager menu item action event handler.
/// </summary>
public class MDLWorkflowTypeSubmitManager
{
public static void main(Args args)
{
// TODO: Write code to execute once a work item is submitted.
// Variable declaration.
BankAccountTrans bankAccountTrans;
PaymReference paymReference;
WorkflowStatusHandler workflowStatusHandler;
recId recId = args.record().RecId;
WorkflowCorrelationId workflowCorrelationId;
ConcurrencyModel concurrencyModel;
container recIds = conNull();
BankAccountStatement bankAccountStatement; // Ensure BankAccountStatement is defined
// Hardcoded type name
workflowTypeName workflowTypeName = workFlowTypeStr("WorkflowType");
// Initial note is the information that users enter when they
// submit the document for workflow.
WorkflowComment initialNote = "PleaseProvideABriefDescriptionorJustificationForThisWorkflowSubmission";
WorkflowSubmitDialog workflowSubmitDialog;
// Opens the submit to workflow dialog.
workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration());
workflowSubmitDialog.run();
if (workflowSubmitDialog.parmIsClosedOK())
{
recId = args.record().RecId;
// Get comments from the submit to workflow dialog.
initialNote = workflowSubmitDialog.parmWorkflowComment();
FormDataSource ds = args.caller().dataSource();
ds.markAllLoadedRecords();
ds = args.caller().dataSource();
ds.markAllLoadedRecords();
// Collect transactions by bank account
Map bankAccountMap = new Map(Types::String, Types::Container);
for (bankAccountTrans = ds.getFirst() as BankAccountTrans;
bankAccountTrans != null;
bankAccountTrans = ds.getNext() as BankAccountTrans)
{
if (bankAccountTrans)
{
// Group transactions by bank account
recIds = bankAccountMap.exists(bankAccountTrans.AccountId) ? bankAccountMap.lookup(bankAccountTrans.AccountId) : conNull();
recIds = conIns(recIds, conLen(recIds) + 1, bankAccountTrans.RecId);
bankAccountMap.insert(bankAccountTrans.AccountId, recIds);
}
}
ttsbegin;
try
{
MapIterator it = new MapIterator(bankAccountMap);
while (it.more())
{
BankAccount bankAccount = it.key();
recIds = it.value();
recId firstRecId = conPeek(recIds, 1);
bankAccountTrans = BankAccountTrans::findByRecId_CN(firstRecId,false);
if (bankAccountTrans)
{
workflowCorrelationId = Workflow::activateFromWorkflowType(workflowTypeName, bankAccountTrans.RecId, initialNote, NoYes::Yes);
// Update the workflow state for each transaction in the group
for (int i = 1; i <= conLen(recIds); i++)
{
bankAccountTrans = BankAccountTrans::findByRecId_CN(conPeek(recIds, i),true);
// Ensure the record is selected before update
if (bankAccountTrans.RecId != 0)
{
bankAccountTrans.MDLWorkflowState = MDLBankAccountWorkflowState::Submitted;
bankAccountTrans.update();
}
}
}
it.next();
}
ttscommit;
// Send an Infolog message.
info("SubmittedToWorkflow");
}
catch (exception::Error)
{
info("@MDLLabel:ErrorOnWorkflowActivation");
}
FormRun callerForm = args.caller();
if (callerForm)
{
callerForm.updateWorkflowControls();
callerForm.dataSource().reread(); // Refresh the data source.
callerForm.dataSource().refresh();
}
}
}
}
Thanks & Regards
Lasya