Hello.
We made a custom Field on the SHOP_ORD table, a checkbox type to know if the SO got printed or not.
The custom event which is supposed to check the CF is nowadays randomly working, when it doesn’t work, it doesn’t do the stuff, no error is showed.
Here is the custom event we made :
LU = ArchiveDistribution
Table = ARCHIVE_DISTRIBUTION_TAB
Fire when : new object + objects changed
Attributes changed on PRINTED
Custom action :
Condition for performing this action : NEW:PRITED = 1
Code (in a deffered call) :
SELECT REPORT_ID INTO v_report_id_
FROM ARCHIVE
WHERE RESULT_KEY = &NEW:RESULT_KEY;
IF v_report_id_ = 'SHOP_ORD_WI_REP' THEN
SELECT PARAMETER_VALUE into v_order_no_
FROM ARCHIVE_PARAMETER
WHERE
RESULT_KEY = &NEW:RESULT_KEY
AND PARAMETER_NAME = 'ORDER_NO';
SELECT PARAMETER_VALUE into v_sequence_no_
FROM ARCHIVE_PARAMETER
WHERE
RESULT_KEY = &NEW:RESULT_KEY
AND PARAMETER_NAME = 'SEQUENCE_NO';
SELECT PARAMETER_VALUE into v_release_no_
FROM ARCHIVE_PARAMETER
WHERE
RESULT_KEY = &NEW:RESULT_KEY
AND PARAMETER_NAME = 'RELEASE_NO';
SELECT OBJID into v_objid_
FROM SHOP_ORD_CFV
WHERE
ORDER_NO = v_order_no_
AND SEQUENCE_NO = v_sequence_no_
AND RELEASE_NO = v_release_no_;
CLIENT_sys.clear_Attr(v_attr_cf_);
CLIENT_sys.Add_To_Attr('CF$_OF_PRINTED_DB','YES',v_attr_cf_);
IFSAPP.SHOP_ORD_CFP.CF_MODIFY__(v_info_,v_objid_,v_attr_cf_,v_attr_, 'DO' );
END IF;