Within Provider Data Management, I wanted a way to capture the Code Table mapping errors thrown by HSPD.MDM.FlowControl.Process into a Workflow Task for someone to work. However, because HSPD.MDM.FlowControl.Process can get overwritten during the upgrade process, I cloned it into another Business Process so we can use Workflow Tasks to troubleshoot mapping errors.
This new Business Process will send the Errors to the Workflow Task Operation, but because it is not the HSPD.MDM.FlowControl.Process resubmitting the message will not resubmit the record to be processed through HSPD.MDM.FlowControl.Process.
So, using a Workflow Template, I am attempting to create another way to Resend the originating message using
##class(Ens.MessageHeader).ResendDuplicatedMessage(MsgHdrID)
If I add the button to the OSU.ExternalFiles.Forms.workFlowTaskTemplate, and tell it to use javascript to call the Class Method Resend, when the button is clicked its not resending the message like it should.
Has anyone added a Button to a %CSP.Page to have it do something similar?
Class OSU.ExternalFiles.Forms.workFlowTaskTemplate Extends %CSP.Page
{
ClassMethod OnPage() As %Status
{
&html<
<table>
<tr>
<td>
Message Source: #(%task.%FormValues.GetAt("MsgSource"))# <br/>
Provider: #(%task.%FormValues.GetAt("Provider"))# <br/>
NPI: #(%task.%FormValues.GetAt("NPI"))# <br/>
Error: #(%task.%FormValues.GetAt("ErrorMsg"))# <br/>
<a href="EnsPortal.VisualTrace.zen?SESSIONID=#(%task.%FormValues.GetAt("MsgHdrID"))#" target="_blank">View Message Trace</a><br/><br/>
<button type='button' onclick='executeCacheCode();'>Resend Message</button>
<script type="text/javascript">
function resendMessage() {
const response = #server(OSU.ExternalFiles.Forms.workFlowTaskTemplate.ResendMessage(%task.%FormValues.GetAt("MsgHdrID")))#;
alert('Result: ' + response);
}
</script>
</td>
</tr>
</table>
>
Quit $$$OK
}
ClassMethod ResendMessage(MsgHdrID As %String) As %String
{
try{
Set tSC = ##class(Ens.MessageHeader).ResendDuplicatedMessage(MsgHdrID)
IF $$$ISERR(tSC){throw tSC}
}
Catch exception {
Set tSC = exception.AsStatus()
W "ERROR:",tSC,!
}
QUIT $$$OK
}
Parameter SrcVer = "$Id$"
}