Skip to main content
Solved

Issue with Reading All Order Numbers for Conditional Email Notification

  • March 6, 2026
  • 2 replies
  • 15 views

Baran
Sidekick (Customer)
Forum|alt.badge.img+4

Hello,

As a system requirement, I want to create an email that works as follows:

  • If wanted receipt date - today = 1, the system should read all order numbers and send an email to the requesters of the orders where this condition is met.

However, I couldn’t figure out how to make the system read all order numbers.

 

The second approach I tried was to create an email directly using the following code, but it still doesn’t read all order numbers:

DECLARE 
text_ VARCHAR2(32767);
subject_ VARCHAR2(2000) := 'Teslim Tarihi Yaklaşıyor';
attach_ VARCHAR2(2000);
wanted_date_ DATE;
diff_days_ NUMBER;

BEGIN

-- Safely convert the date
wanted_date_ := TRUNC(
TO_DATE(SUBSTR('&NEW:WANTED_RECEIPT_DATE',1,10),'YYYY-MM-DD')
);

-- Calculate day difference
diff_days_ := wanted_date_ - TRUNC(SYSDATE);

-- If 1 day remains
IF diff_days_ >= 1 THEN

text_ := 'Sayın İlgili,';
text_ := text_ || '<br><br>';
text_ := text_ || '&NEW:REQUISITION_NO' ||
' numaralı satın alma talebinin teslim tarihi yaklaşmaktadır.';
text_ := text_ || '<br>';
text_ := text_ || 'Teslim tarihine 3 gün kalmıştır.';
text_ := text_ || '<br><br>';
text_ := text_ || 'Bilginize sunulur.';

command_sys.mail(
sender_ => 'Satın Alma',
from_ => '--',
to_list_ => 'barancelik@ahsap.com.tr',
subject_ => subject_,
text_ => text_,
attach_ => attach_,
rowkey_ => '',
mail_sender_ => 'MAIL_SENDER_HTML');

END IF;

END;

 

My question is: How can I make the system read all order numbers and select only the ones that meet the condition?

Regards,
Baran

Best answer by N.GEORGI

@Baran, you need to activate the Read Collection Option on your Projection Delegate element

 

 

2 replies

Michael Kaiser
Sidekick (Customer)
Forum|alt.badge.img+9
  • Sidekick (Customer)
  • March 10, 2026

Hi Baran,
I’m not quite shure if I get this right but tried to analyze it:
SELECT < your fields > FROM PURCHASE_ORDER_TAB 
WHERE DATE_ENTERED (or ORDER_DATE) = SYSDATE - 1
AND BUYER_CODE = <your value>

When you have an ORACLE Client on a server with MS SQL Server installed you can create a LinkedServer-connection and put a
SELECT * from openquery(<LinkedServerName>,

ORACLE - SQL (when using ‘ double them)

) around that SQL.

To send mails we use the SQL Server Agent for errors or
exec msdb.dbo.sp_send_dbmail  

HTH
BR
Michael

 


Forum|alt.badge.img+8
  • Hero (Customer)
  • Answer
  • March 10, 2026

@Baran, you need to activate the Read Collection Option on your Projection Delegate element