Question

COMMAND_SYS.mail

  • 16 December 2022
  • 4 replies
  • 263 views

Userlevel 3
Badge +10

I am using the command_sys.mail command and passing a string which has 3 usernames as follows:

but when I look in application message it has only passing 1 email address, am I doing something wrong ?


4 replies

Userlevel 7

Hi @JannetteC, can you post the full code please? It’d be a lot easier to determine where it goes wrong.

Userlevel 5
Badge +14

Hi,

 

I think it is better to write e-mail addresses. Can you try with e-mails?

Userlevel 3
Badge +10

Here is the code:

DECLARE
to_user_name_ varchar2(2000) :=null ;
Group_Person_id_ varchar2(2000);

Cursor c1 is SELECT PERSON_ID FROM DOCUMENT_GROUP_MEMBERS WHERE GROUP_ID='X_APPROVAL_MAINT';

BEGIN

For cur_group in c1 loop
Group_Person_id_ := Group_Person_id_ || cur_group.Person_id || ';'  ;
End loop;

If  Nvl('&NEW:PERSON_ID',' ') = ' ' Then 
to_user_name_ :=  Group_Person_id_ ;
Else 
to_user_name_ := IFSAPP.PERSON_INFO_API.Get_User_Id('&NEW:PERSON_ID') ;
End If;

--IFSAPP.Error_SYS.Record_General(' ', to_user_name_ );

COMMAND_SYS.mail(from_user_name_ =>'#USER_ID#',
                   to_user_name_ => to_user_name_ , 
                   text_ => 'Work Order Requires Approval - '||  '&NEW:DESCRIPTION' || '<br> <br>' || 
'Click Here to View: <br>' || chr(10) || 'https://pa-ifs-ext-v.portav.co.uk:48080/client/runtime/Ifs.Fnd.Explorer.application?url=ifsapf%3AtbwApproval%3FACTION%3Dpopulate' ,
                   subject_ => 'Work Order Requires Approval - ' || '&NEW:DESCRIPTION',
                   attach_ => null);

END; 

Hi, You could place the Command_Sys.Mail method inside of the cur_group loop and send using the person_id instead.  Should send it to everyone returned from the c1 query.
    
    DECLARE
        Group_Person_id_ varchar2(2000);
        to_user_name_ varchar2(2000) :=null ;
        Cursor c1 is SELECT PERSON_ID, GROUP_ID FROM DOCUMENT_GROUP_MEMBERS WHERE GROUP_ID = '%X_APPROVAL_MAINT';
         
    BEGIN
    
        for cur_group in c1 loop
            Group_Person_id_ := Group_Person_id_ || cur_group.Person_id || ';'  ;
            DBMS_OUTPUT.PUT_LINE(GROUP_PERSON_ID_);
            
            COMMAND_SYS.mail(from_user_name_ =>'IFSAPP',
                       to_user_name_ => cur_group.Person_id , 
                       text_ => 'Work Order Requires Approval',
                       subject_ => 'Work Order Requires Approval',
                       attach_ => null);
        end loop;
        
    
    END;

 

Reply