Solved

Custom Attribute in a Custom Event

  • 23 June 2021
  • 4 replies
  • 72 views

Userlevel 4
Badge +7

I have read all of the existing Custom Event topics and don’t see anything that helps me with this. I believe it is a simple syntax issue but have tried everything I can think of, unsuccessfully. 

I am trying to calculate the cost of overissued material for a shop order component at the time it is overissued. It is all working fine, including custom attributes until I try to add one of the custom attributes to a calculation: 

The Attribute ‘Part Cost’ is calculating correctly and the Over_Cost attribute works until I add * Part_Cost  (to multiply the result of Qty_Issued - Qty_required times the part cost). 

When I add that Part Cost to the Over_Cost attribute, the event will no longer trigger. I have tried to specific Part_Cost in the calculation as Part_Cost and  :Part_cost  and &Part_Cost and “Part_Cost” and :NEW.Part_Cost and get varying errors with each. 

 

 

 

 

 

Any syntax help is greatly appreciated. I love the Event/Event actions tool and the ability to add Custom Attributes. It lets me provide good info and actions for my internal customers. 

icon

Best answer by Charith Epitawatta 23 June 2021, 17:11

Hi @KLAVALLEY,

I haven’t tried this particular setup, but you most likely cannot use one custom attribute in another since the values need to be calculated real time. Instead of specifying PART_COST after ‘*’ operator, have you tried specifying the whole server method of PART_COST within parentheses? It would make the server method of OVER_COST extremely, long, but should work.

Eg:

OVER_COST = (:NEW.QTY_ISSUED - :NEW.QTY_REQUIRED)*(CONT1APP.INVENTORY_PART_UNIT_COST_API.GET_INVENTORY_VALUE_BY_METHOD(<arguments>))

Hope this helps!

View original

4 replies

Userlevel 6
Badge +10

Hi @KLAVALLEY ,

 

Have you checked the “Part_cost” is there in the table - shop_material_alloc_tab.

Userlevel 4
Badge +7

Hi Dumeesha, 

No, that Custom Attribute is not in the shop_material_alloc_table. I am creating it as a custom attribute in the event,  that I hope to use in the calculation of another custom attribute in the event. Should I expect a custom attribute that is created in a custom event to appear in the table that the event is triggering from? 

Thanks

Userlevel 7
Badge +12

Hi @KLAVALLEY,

I haven’t tried this particular setup, but you most likely cannot use one custom attribute in another since the values need to be calculated real time. Instead of specifying PART_COST after ‘*’ operator, have you tried specifying the whole server method of PART_COST within parentheses? It would make the server method of OVER_COST extremely, long, but should work.

Eg:

OVER_COST = (:NEW.QTY_ISSUED - :NEW.QTY_REQUIRED)*(CONT1APP.INVENTORY_PART_UNIT_COST_API.GET_INVENTORY_VALUE_BY_METHOD(<arguments>))

Hope this helps!

Userlevel 4
Badge +7

Thank you, Charith!  that worked perfectly!  

Reply