Skip to main content
Solved

Custom Attribute in a Custom Event


Forum|alt.badge.img+8

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. 

Best answer by Charith Epitawatta

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
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

Dumeesha Wanigarathna
Superhero (Partner)
Forum|alt.badge.img+16

Hi @KLAVALLEY ,

 

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


Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • 40 replies
  • June 23, 2021

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


Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

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!


Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • 40 replies
  • June 23, 2021

Thank you, Charith!  that worked perfectly!  


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings