Solved

Apply criteria to a standard menu item

  • 24 February 2020
  • 3 replies
  • 489 views

Userlevel 3
Badge +9

i want  ‘Create Pick List’ on the Quick Order Flow Handling Menu to be visible (or not visible) based on the value of a custom field held against the Customer. Is there a way to achieve this?

Initially I was going to remove permission to it, and add in my own custom menu item which called the following code.

IF (CUSTOMER_CREDIT_INFO_CFP.Get_Cf$_Credit_Block(objkey_) <> 'Yes') THEN
  p1_ := Customer_Order_Transfer_API.Allowed_To_Send(ord_no_, 'ORDRSP');
  Customer_Order_Flow_API.Check_All_License_Connected(p1_, ord_no_);
  attr_ := 'START_EVENT70ORDER_NO' || ord_no_ || 'END';
  Customer_Order_Flow_API.Start_Create_Pick_List__(attr_);
  COMMIT;
END IF; 

These commands are shown in debug console when you create pick list from the QOFH screen, but don’t seem to work when i call them in a procedure. Appreciate any help with the code, or with applying criteria to menu items.

TIA. Chris.

 

 

icon

Best answer by Harley 28 February 2020, 22:01

View original

3 replies

Userlevel 7
Badge +21

Chris,

Have you tried to push the coding in a deferred job. I know this may slow down the work for the user, but you might have a bit more controle over the deferred job.

Regards,
Steve

Userlevel 4
Badge +8

Hi Chris

I am not aware of a way of controlling the visibility of standard menu items other that permissions as you suggest, or alternatively via a user profile (right-click, Properties, Advanced). Controlling this via a base profile might be preferable to security.

With regard to the code from a custom menu there are a few things to note. As far as i am aware the only fields that you can pass to the PL/SQL block as bind variables are from the base view for the screen you are on. For Quick Order Flow Handling the base view is CUSTOMER_ORDER. You can check the base view via system info.

Your code therefore has a number of issues because you are referring to variables such as objkey_ that are not declared.

The following may give you something to start with and work on

  1. Consider the elements from the base view that you will need to pass and declare these. In this case Customer Number, Site (to get company) and Order Number
  2. Then consider the elements that are not in the view but you will need to set to call functions or procedures. Here you will need company and objkey from cust cred info and an attribute variable
  3. Then you are in a position to construct the main code block that as you have said, can largely be constructed by copying code from a debug.

declare
  customer_no_ varchar2(20) := &CUSTOMER_NO;
  contract_    varchar2(5) := &CONTRACT;
  order_no_    varchar2(12) := &ORDER_NO;
  company_     varchar2(20);
  objkey_      varchar2(200);
  attr_        varchar2(2000);
begin
  company_ := SITE_API.get_company(contract_);
  objkey_ := CUSTOMER_CREDIT_INFO_CFP.Get_Objkey(company_  => company_,
                                                 identity_ => customer_no_);
  IF (CUSTOMER_CREDIT_INFO_CFP.Get_Cf$_Credit_Block(objkey_) <> 'Yes') THEN
    attr_ := 'START_EVENT' || chr(31) || '70' || chr(30) || 'ORDER_NO' ||
             chr(31) || order_no_ || chr(30) || 'END' || chr(31) || '' ||
             chr(30);
    Customer_Order_Flow_API.Start_Create_Pick_List__(attr_ => attr_);
  END IF;
END;

 

To my knowledge the visibility of this custom menu (using the Condition Manager) only lets you use fields from the base view. One thing you may want to do is add an ELSE to the code to present a warning/error to alert the user that the pick has not been created.

 

Given the limitations mentioned above, i would perhaps look at another way to achieve your goal. For example you could surface a custom field on the QOFH screen that references your custom field from customer credit info. You could even use this in conditional formatting to make it clear to the user that this is a special status.

Hope this helps.

Harley

Badge +1

  

Reply