Question
· 3 hr ago

Adding a button to %CSP.Page to execute ResendDuplicatedMessage

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
}

/// Location and Revision of this file in Perforce (Auto-updating)
Parameter SrcVer = "$Id$";

}
$ZV: HealthShare Provider Directory 2024.2.0 Build: 1009 [HealthShare Modules: Core:28.0 + Provider Directory:28.0] - IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2024.1 (Build 267_2_24113U) Wed Jul 2 2025 16:36:55 EDT [Core:28.0|Provider Directory:28
Discussion (0)1
Log in or sign up to continue