Question

Event Actions

  • 28 October 2020
  • 5 replies
  • 1131 views

Userlevel 2
Badge +8

Hi,

I need examples to below things to write script in Event Action

  1. create a new record
  2. update a record and 
  3. delete a record 
  4. attachment a quick report or query records as excel to the mail
  5. Error and info messages
  6. how to create a custom function
  7. where to create a custom function in IFS Enterprise Explorer 
  8. How to call a custom function

I saw this line in my system 

Transaction_SYS.Deferred_Call('C_ML_INVENT_UTIL_API.Perform_Unreserve_So',  attr_,  description_);

What is C_ML_INVENT_UTIL_API.Perform_Unreserve_So and Transaction_SYS.Deferred_Call?

If we want to write a new where we can in FS Enterprise Explorer?

 

Thanks,

Narsi.


5 replies

Userlevel 5
Badge +11

Hi @Narsi,

You seems to be asking for a full training manual!

One of the best ways to discover the code you want to use is via debugging. You can find out exactly what code runs when you create or delete a record or make a change and then use that code as a template to work with. Take a look at this thread with brief instructions on debugging.

Ged.

Userlevel 7
Badge +18

One thing that debugging won’t show you is how to build values for the attr_ string. I used to concatenate CHR(31) and CHR(30) until I learned about the CLIENT_SYS package.

 

/*
IFS logical units have base views and base packages.
Let's assume we have the logical unit HelloWorld.
It'll have a base view HELLO_WORLD and a base package HELLO_WORLD_API. (Each
change in character case, which represents a new word, is represented by an
underscore, since Oracle object names aren't ordinarily case sensitive.)
*/

DECLARE
info_ VARCHAR2(32767);
-- I like to use %TYPE constructions whenever possible.
-- They make the code more self-documenting by revealing the purpose of variables.
objid_ hello_world.objid%TYPE
objversion_ hello_world.objversion%TYPE;
attr_ VARCHAR2(32767);
BEGIN
-- This sets attr_ to NULL, but the exact implementation may change
client_sys.clear_attr(attr_);
-- This fills in the default values for a new record
hello_world_api.new__(info_, objid_, objversion_, attr_, 'PREPARE');
-- This adds a value for some column that wasn't defined in PREPARE
client_sys.add_to_attr('SOME_FIELD_NAME', 'some value', attr_);
-- This overrides a value that might have been populated by PREPARE
client_sys.set_item_value('SOME_FIELD_NAME', 'some value', attr_);
-- This creates a new record
hello_world_api.new__(info_, objid_, objversion_, attr_, 'DO');
END;
/

 

Userlevel 5
Badge +11

I know I should use .add_to_attr but I’m an old dog and still use chr() method. Maybe I’ll update my templates one day!

Userlevel 7
Badge +18

I know I should use .add_to_attr but I’m an old dog and still use chr() method. Maybe I’ll update my templates one day!

Probably the most compelling reason to use ADD_TO_ATTR is that it has an overload to automatically format DATE values. You won’t have to think much about your data types.

Userlevel 5
Badge +11

I know I should use .add_to_attr but I’m an old dog and still use chr() method. Maybe I’ll update my templates one day!

Probably the most compelling reason to use ADD_TO_ATTR is that it has an overload to automatically format DATE values. You won’t have to think much about your data types.

OK. I’m sold! :laughing:

Reply