I have created a Persistent custom field in Sales Basic Data → Salesman to enter Sales manager of each salesman.
I have created another custom field in Customer order → Misc Order info tab and I want to update Sales manager’s id into that custom field using an event.
i created an event to achive that but i am getting no result. Customer order doesn’t fire any error too.
Can you let me know where the issue is ?
WHERE salesman_code = '&NEW:SALESMAN_CODE';
IF CUSTOMER_ORDER_API.Get_Authorize_Code('&NEW :ORDER_NO') = 'IWT' THEN
SET CF$_S_MANAGER = SalesM_
WHERE rowkey = (SELECT rowkey
WHERE order_no = '&NEW:ORDER_NO');
Best answer by anmise
There are challenges in the way you are achieving this. But I am struggling to understand why you are doing it. Is it because you want to store info on the current sales manager when the order was released?
Yes. Business want save this data and populate these into reports. If i use reference fields I assume that i won’t be able to see history data if manager got changed
Maybe you could trigger it on the CustomerOrderHistory instead. Below code works, but you’d obviously have to add/tweak some conditions either in the event action
Or in the code:
info_ VARCHAR2(4000) := NULL;
Cursor get is
select objid, ifsapp.SALES_PART_SALESMAN_CFP.Get_Cf$_Sales_Manager(SALES_PART_SALESMAN_CFP.Get_Objkey(salesman_code)) salesmanager
WHERE order_no= '&NEW:ORDER_NO';
IF '&NEW:HIST_STATE' = 'Released' AND '&NEW:MESSAGE_TEXT' = 'Released' THEN
FOR rec_ in get LOOP
Client_SYS.Add_To_Attr('CF$_SALES_MANAGER', rec_.salesmanager, attr_cf_);
IFSAPP.Customer_Order_Cfp.Cf_Modify__(info_, rec_.objid, attr_cf_, attr_, 'DO');