Skip to Content
author's profile photo Former Member
Former Member

User mail Id determination using Rule

Hello Gurus,

I am very new to workflow.
I need help to determine agent's mail id at run time to be used to send mail notification to them, for that I have created a rule and created a FM to determine mail id.
I have created a container in the rule as agent_id, the same container I have created in workkflow and binding it with workflow.
but I have no idea what is the task I have to given and if needed to create what would be the purpose of it, as my purpose of getting mail id is fulfilled by rule and its container.
I can't activate the wf as its asking for task.
Any suggestion on this and is there any alternative solution.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 27, 2013 at 04:33 AM

    Hi Salil

    Amalendu also has suggested a good approach.....from the method, he is calling a rule using 'RH_GET_ACTORS'.

    For your other question, there is no need for macros to be called in the method, The method can have importing parameter as Notification Number (which will be passed from the task).

    The method can then call the FM and provide the Notification Number to the FM and receive the email ID.

    This email ID is passed back as an exporting parameter from the method, back to the class and then to the workflow.

    Hope it clarifies.

    Regards,

    Modak

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 26, 2013 at 07:02 AM

    Hi Salil

    Why did you use a rule for this? Any specific reasons?

    Why not use a BO/Class Method, call the same FM, and call that Method in a Task (type Activity) as a background step.

    Input -> agent_id

    Output -> Email ID (in a workflow container)

    After that use a mail step and use the email in addressstring of the mail step.

    There are other ways too, however, since you are new to workflows , I would suggest the above simpler version.

    Regards,

    Modak


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Modak Gupta

      Hi Modak,

      Thanks for the help, but still its not working.
      I will attach screen shot and I am not getting where I am missed.

      1) Workflow calls a task from the activity step

      2) In the binding, WF passes the Notification No. to task and receives the email ID from task

      3) The Task calls the custom BO/Class method and passes necessary data / receives necessary data from the method.

      4) The method calls the revised FM (signature has the agent id as importing and email as the exporting parameters).......remove macro calls from the method and use the imported parameter to get the email.

      Here I have doubt in 3rd and 4th point.
      I am using Notification No to determine the email id instead of Agent ID by passing the notification no in FM in import parameter and getting email address at export Parameter.

      Now I have to pass the notification No to the FM for that purpose I have created parameters of that particular method.

      The notification No as export parameter and Email id as import Parameter.
      Now I am using Macro in the program of that method to get the value of Notification no and then using that to determine the mail id through FM, and then using macro to assign the mail id back to the container.
      I think here I am doing something wrong.
      Please clarify if I am not going to use the macro in the method, how I will set the value of email id back to container.
      After Executing the WF, I can see that Notification no is getting assigned to the container of the method but email id is empty

  • author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 07:14 PM

    Hi,

    Steps to find mail id from a rule to your workflow.

    Here, you have to bind workflow to task, task to BOR, from BOR you have to call the rule (which will have bindings between rule container and Z-Function Module)

    Simple steps:

    Assumptions: You have PERNR value and you need to find mail id.

    1. First create a rule - create two elements in rule container - PERNR and mailid (set both of them to import and export)

    2. Create a Z-FM - in it get the container element PERNR using SWC_GET_ELEMENT.

    Write your logic ; and then using SWC_SET_ELEMENT set the mail id in ac_container (in tables parameter in your Z-FM)

    3. Then create an activity in your workflow, in that create one task.

    4. In task container again create same two container elements.

    5. Create one Z BOR object and method - assign it to task.

    6. In Z-BOR object-method, write the following code.

    SWC_GET_ELEMENT CONTAINER 'PersonnelNumber' lw_pernr1.

    lw_act_role(2) = 'AC'.

    lw_act_role+2 = '<rule no>'.

    CALL FUNCTION 'RH_OM_ATTRIBUTES_CONTAINER_GET'

    EXPORTING

    ACT_ROLE = lw_act_role

    TABLES

    ACTOR_CONTAINER = lt_act_container

    EXCEPTIONS

    OTHERS = 0.

    CALL FUNCTION 'RH_GET_ACTORS'

    EXPORTING

    ACT_OBJECT = lw_act_role

    TABLES

    ACTOR_CONTAINER = lt_act_container

    ACTOR_TAB = lt_actor_tab

    EXCEPTIONS

    OTHERS = 0.

    IF NOT lt_act_container IS INITIAL.

    <your logic - get the container value for element 'mailid' - created container element>

    SWC_SET_ELEMENT CONTAINER 'mailid' lv_mailid.

    ENDIF.

    7. create proper bindings between workflow container and task container (whose element values BOR object sets in the above code)

    8. You got your mailid in workflow container!!!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.