I create an agent that listen to the "Location - created" event.
The main action is direct update sql in case when the created location has role BILL-TO. In this case my direct update sql action must to write into the SERVPROV table a record with an equal GID and XID as in LOCATION record.
1) Assign variable $LOCATION_GID_OR_NODATA
Saved query text is:
SELECT NVL((SELECT l.location_gid
FROM location l, location_role_profile lrp
WHERE l.location_gid = lrp.location_gid
AND lrp.location_role_gid = 'BILL TO'
AND ROWNUM = 1
AND l.location_gid = ? ),
'NO_DATA')
FROM DUAL
2) IF $LOCATION_GID_OR_NODATA<>NO_DATA
3)DIRECT UPDATE SQL
The text of the query is:
insert into servprov
(servprov_gid,
servprov_xid,
auto_payment_flag,
is_dispatch_by_region,
allow_tender,
is_accept_spot_bids,
is_accept_broadcast_tenders,
is_localize_broadcast_contact,
do_conditional_accepts,
is_internal_nvocc,
is_accept_by_ssu_allowed,
is_copy_inv_delta_back_to_ship,
invoicing_process)
values
($LOCATION_GID_OR_NODATA,
$LOCATION_GID_OR_NODATA, //let it will be so
'N','N','N','N','N','N','N','N','N','N','S')
4) END IF
If I set for the "Location - created" event option "Before Persist" checked then agent is run but it get Java Null Pointer Exception
If I do not set option "Before Persist" - then my agent does not started in general.
Please help me anyone.
The main action is direct update sql in case when the created location has role BILL-TO. In this case my direct update sql action must to write into the SERVPROV table a record with an equal GID and XID as in LOCATION record.
1) Assign variable $LOCATION_GID_OR_NODATA
Saved query text is:
SELECT NVL((SELECT l.location_gid
FROM location l, location_role_profile lrp
WHERE l.location_gid = lrp.location_gid
AND lrp.location_role_gid = 'BILL TO'
AND ROWNUM = 1
AND l.location_gid = ? ),
'NO_DATA')
FROM DUAL
2) IF $LOCATION_GID_OR_NODATA<>NO_DATA
3)DIRECT UPDATE SQL
The text of the query is:
insert into servprov
(servprov_gid,
servprov_xid,
auto_payment_flag,
is_dispatch_by_region,
allow_tender,
is_accept_spot_bids,
is_accept_broadcast_tenders,
is_localize_broadcast_contact,
do_conditional_accepts,
is_internal_nvocc,
is_accept_by_ssu_allowed,
is_copy_inv_delta_back_to_ship,
invoicing_process)
values
($LOCATION_GID_OR_NODATA,
$LOCATION_GID_OR_NODATA, //let it will be so
'N','N','N','N','N','N','N','N','N','N','S')
4) END IF
If I set for the "Location - created" event option "Before Persist" checked then agent is run but it get Java Null Pointer Exception
If I do not set option "Before Persist" - then my agent does not started in general.

Please help me anyone.
Comment