Skip to Main Content

E-Business Suite

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating a custom rule in Docupresentment

Dave SandersJun 13 2023

In an earlier question to the forum, I was asking if there is a Documaker api that could be called that would return ERRS and LOGS for a given Trn_Id (there is not). So I got to thinking about creating my own custom rule that could:

  1. Receive the TrnErrId in the request
  2. Query the ERRS table for that TrnErrId
  3. Put the query results into the response

For now, I am just using javascript because it's quick, but I will eventually me migrating it to java. I need help getting this set up and I am struggling with reading and setting message variables. My current configuration is as follows:

I added the following to the idmk_java_requests.ini file:

[ReqType:ERRS]
; Returns ERRS and LOGS for a given TRN_ID
    function        = atcw32->ATCLogTransaction
    function        = atcw32->ATCLoadAttachment
    function        = atcw32->ATCUnloadAttachment
    function        = dprw32->DPRSetConfig
    function        = script;getErrors.js;runRule
    function        = java;com.docucorp.ids.rules.CopyDataRule;copyit;transaction;copyMessageVariables;TAG_AND_FOLLOW,CONFIG,TrnErrId,ErrResults

And my javascript file (getErrors.js) looks like this:

function runRule(requestState, idsArgs, idsMessage) {
    switch (idsMessage) {
        case IDSConstants.init :
            break;
        case IDSConstants.runForward :
            requestState.getOutput().getMsgVar("TrnErrId");
            requestState.getOutput().setMsgVar("ErrResults", "TEST");
            break;
        case IDSConstants.runReverse :
            requestState.getOutput().getMsgVar("TrnErrId");
            requestState.getOutput().setMsgVar("ErrResults", "TEST");
            break;
        case IDSConstants.terminate :
            break;
    }
    return IDSConstants.success;
   }

and my SOAP request looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="oracle/documaker/schema/ws/composition" xmlns:com1="oracle/documaker/schema/ws/composition/common" xmlns:v1="oracle/documaker/schema/ws/composition/doCallIDS/v1" xmlns:com2="oracle/documaker/schema/common" xmlns:req="oracle/documaker/schema/ws/composition/doCallIDS/v1/request">
   <soapenv:Header/>
   <soapenv:Body>
      <com:DoCallIDSRequest>
         <com:DoCallIDSRequestV1>
            <com1:timeoutMillis>30000</com1:timeoutMillis>
            <v1:IDSRequest>
               <req:DSIMSG>
                  <com1:MSGVARS>
                     <com1:VAR NAME="ReqType">ERRS</com1:VAR>
                     <com1:VAR NAME="TrnErrId">12345</com1:VAR>                
                  </com1:MSGVARS>
               </req:DSIMSG>
            </v1:IDSRequest>
         </com:DoCallIDSRequestV1>
      </com:DoCallIDSRequest>
   </soapenv:Body>
</soapenv:Envelope>

I can get it to run and my result returns the TrnErrId but not the new one that I am trying to add (ErrResults).

Any thoughts would be much appreciated.

Dave

This post has been answered by Dave Sanders on Jun 30 2023
Jump to Answer
Comments
Post Details
Added on Jun 13 2023
1 comment
207 views