[ExtensionOf(tableStr(projproposaljour))] final class DTProjInvoiceJourWorkFlowSubmit_Extension { public boolean canSubmitToWorkflow(str _workflowType) { PSAProjProposalProj pSAProjProposalProj; ReasonTableRef reasonTableRef; ProjParameters projParameters; next canSubmitToWorkflow( _workflowType); boolean ret = false; while select InvoicedNow from pSAProjProposalProj where pSAProjProposalProj.ProjProposalId == this.ProposalId { select firstonly projParameters where projParameters.DataAreaId == this.DataAreaId; if( PSAProjProposalProj.InvoicedNow <= 0) { if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && this.DTOriginalTaxInvoiceNo == '' && projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { throw error("The Original Invoice field & Reason Code field is mandatory. Cannot proceed further."); } } if( PSAProjProposalProj.InvoicedNow <= 0) { if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && this.DTOriginalTaxInvoiceNo == '') { throw error("The Original Invoice field is mandatory. Cannot proceed further."); } } if( PSAProjProposalProj.InvoicedNow <= 0) { select Reason,RecId from reasonTableRef where reasonTableRef.RecId == this.ReasonTableRef; if(projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { throw error("The Reason Code field is mandatory. Cannot proceed further."); } } } return ret; } }
[ExtensionOf(tableStr(projproposaljour))] final class DTProjInvoiceJourWorkFlowSubmit_Extension { public boolean canSubmitToWorkflow(str _workflowType) { PSAProjProposalProj pSAProjProposalProj; ReasonTableRef reasonTableRef; ProjParameters projParameters; next canSubmitToWorkflow( _workflowType); boolean ret = false; while select InvoicedNow from pSAProjProposalProj where pSAProjProposalProj.ProjProposalId == this.ProposalId && PSAProjProposalProj.InvoicedNow <= 0 { select firstonly projParameters where projParameters.DataAreaId == this.DataAreaId; if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes) { if(this.DTOriginalTaxInvoiceNo == '') { if(projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { throw error("The Original Invoice field & Reason Code field is mandatory. Cannot proceed further."); } else { throw error("The Original Invoice field is mandatory. Cannot proceed further."); } } } select Reason,RecId from reasonTableRef where reasonTableRef.RecId == this.ReasonTableRef; if(projParameters.DTReasonCodeMandatory == NoYes::Yes && reasonTableRef.Reason == '') { throw error("The Reason Code field is mandatory. Cannot proceed further."); } } return ret; } }
public static void main(Args _args) { RecID recID = _args.record().RecId; TableId tableId = _args.record().TableId; ProjProposalJour projProposalJour = _args.record(); WorkflowWorkItemTable workItem = _args.caller().getActiveWorkflowWorkItem(); WorkflowSubmitDialog workflowSubmitDialog; WorkflowComment wfComment; workflowTypeName workflowTemplateName = workFlowTypeStr('PSAProjInvoiceProposal'); PSAProjProposalProj pSAProjProposalProj; ReasonTableRef reasonTableRef; ProjParameters projParameters; // The method has not been called correctly. if (tableId != tablenum(ProjProposalJour) || recId == 0) { throw error(strfmt("@SYS19306", funcname())); } if (projProposalJour.RecId != 0) { while select InvoicedNow from pSAProjProposalProj where pSAProjProposalProj.ProjProposalId == projProposalJour.ProposalId { select firstonly projParameters where projParameters.DataAreaId == projProposalJour.DataAreaId; if( PSAProjProposalProj.InvoicedNow <= 0) { if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && projProposalJour.DTOriginalTaxInvoiceNo == '' && projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { info("The Original Invoice field & Reason Code field is mandatory. Cannot proceed further."); //ret = ret && false; } } if( PSAProjProposalProj.InvoicedNow <= 0) { if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && projProposalJour.DTOriginalTaxInvoiceNo == '') { info("The Original Invoice field is mandatory. Cannot proceed further."); //ret = ret && false; } } if( PSAProjProposalProj.InvoicedNow <= 0) { select Reason,RecId from reasonTableRef where reasonTableRef.RecId == projProposalJour.ReasonTableRef; if(projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { Info("The Reason Code field is mandatory. Cannot proceed further."); //ret = ret && false; } } } else { // The journal does support workflow approvals. workflowSubmitDialog = WorkflowSubmitDialog::construct(_args.caller().getActiveWorkflowConfiguration()); workflowSubmitDialog.run(); }
[ExtensionOf(classStr(PSAProjInvoiceProposalSubmitToWF))] final class DTPSAProjInvoiceProposalSubmitToWF_Extension { // Description : test if the invoice proposal can be submitted to workflow public static void main(Args _args) { RecID recID = _args.record().RecId; TableId tableId = _args.record().TableId; ProjProposalJour projProposalJour = _args.record(); WorkflowWorkItemTable workItem = _args.caller().getActiveWorkflowWorkItem(); WorkflowSubmitDialog workflowSubmitDialog; WorkflowComment wfComment; workflowTypeName workflowTemplateName = workFlowTypeStr('PSAProjInvoiceProposal'); PSAProjProposalProj pSAProjProposalProj; ReasonTableRef reasonTableRef; ProjParameters projParameters; // The method has not been called correctly. if (tableId != tablenum(ProjProposalJour) || recId == 0) { throw error(strfmt("@SYS19306", funcname())); } if (projProposalJour.RecId != 0) { while select InvoicedNow from pSAProjProposalProj where pSAProjProposalProj.ProjProposalId == projProposalJour.ProposalId { select firstonly projParameters where projParameters.DataAreaId == projProposalJour.DataAreaId; if( PSAProjProposalProj.InvoicedNow <= 0) { select Reason,RecId from reasonTableRef where reasonTableRef.RecId == projProposalJour.ReasonTableRef; if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && projProposalJour.DTOriginalTaxInvoiceNo == '' && projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { throw error("The Original Invoice field & Reason Code field is mandatory. Cannot proceed further."); //ret = ret && false; } else if(projParameters.DTOriginalInvoiceMandatory == NoYes::Yes && projProposalJour.DTOriginalTaxInvoiceNo == '') { throw error("The Original Invoice field is mandatory. Cannot proceed further."); //ret = ret && false; } else if(projParameters.DTReasonCodeMandatory == NoYes::Yes && ReasonTableRef.Reason == '') { throw error("The Reason Code field is mandatory. Cannot proceed further."); //ret = ret && false; } } } } // Make the form refresh its common workflow UI controls. PSAProjInvoiceProposalSubmitToWF::refreshCaller(_args); next Main(_args); } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 1,771
André Arnaud de Cal... 806 Super User 2025 Season 2
Sohaib Cheema 542 User Group Leader