wfNotify in IDOC to send mail | csScriptMustBeInWorkflowContext

408 Views Asked by At

I have created & called a custom service in my custom template to send mails to users when document gets sent/reject/approve. I want to copy myself in BCC in these mails so that in case of any issues, i could cross check. is there a way i can enter a specific mail address in this code. below is the code i 'm using. Will "wfNotify" be of any help?

code used

<$executeService("APPROVAL_MAIL_PILOT_USERS")$>
<$loop IS_PILOT_USER$>
<$userValue=IS_PILOT_USER.USEREXISTS$>
<$endloop$>
<$if strEqualsIgnoreCase(userValue,"1")$>

            ----MailFormat----

P.S- when i use wfNotify -> , i get the error

Caused by: intradoc.common.ServiceException: !csScriptMustBeInWorkflowContext,wfNotify
    *ScriptStack !csDynHTMLStackDumpStart,pbhati,(datasummary)IdcService=WORKFLOW_SENDTO\,dDocName=D_1247583\,dID=1421894!$
!csDynHTMLNoStack!$
!csDynHTMLErrorMessage,/u01/Oracle/Middleware/user_projects/domains/base_domain/ucm/cs/custom/Workflow/templates/Workflow_reviewer_mail.htm,44,3!csDynHTMLReportMsgFunction,wfNotify!$
    -><$wfNotify(xDocOwner,"user")$>
2

There are 2 best solutions below

0
On BEST ANSWER

As far as I know, wfNotify can only be called from inside a workflow event which is why you are receiving the csScriptMustBeInWorkflowContext error.

As to a service or Idoc Script function (besides wfNotify) that can be used to send an email to a specific user/alias/token and use a custom template, I could not locate one.

You could create your own scriptable service (which you can then call from Idoc Script) or an Idoc Script function that would allow for this.

5
On

You can call wfNotify with the specific username. But the user must have their email details completed in the user table.

Your second error with the wfNotify call - are you calling wfNotify with a 3rd param for the template? If so - eliminate this as a source of your problem by just calling wfNotify with the first two params.

wfNotify Oracle Documentation