AR Invocie Post - SubmitToAgent

Trying to use Post AR Invoice programatically from Cash Receipt Form, however not sure how to catch this.
Already Identified using Trace that, following BO and Methods are being used :


Already added the Custom Reference of this .dll but not sure how to proceed.


I have managed to call SubmitToAgent , however Task is getting created in SysAgentSched but not falling in Systask Table. I get the following Server Error:

System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint “FK_SysAgentTask_SysAgentSched”. The conflict occurred in database “ERP10TEST”, table “Ice.SysAgentSched”.

any Clue will be helpful.

Are you specifying a sysagent or leaving it empty? Try leaving it empty, I think it should pick up the default agent to process it.