Solved

Modification of a Custom Package (CFP)

  • 27 February 2020
  • 7 replies
  • 786 views

Badge +2

Hi!

When a custom LU and fields are added, IFS automatically creates a package to insert, modify and delete custom data.

Is there a way to safely modify e.g. CF_NEW__ procedure in the custom package to add extra validations?

I assume the CFP package will be overwritten when e.g. a new custom field is added or reinstalled and all changes will be lost, so it is probably not straightforwad.

Any ideas? Thanks!

 

Regards,

Rafal

 

icon

Best answer by CallumW 27 February 2020, 13:57

View original

7 replies

Userlevel 6
Badge +15

From the sounds of it you are trying to validate when a user is trying to save a new custom field value to the database.

I believe you are correct in saying that the CFP package is overwritten when any update is applied to any of the attributes.

 

You could control the validation using a custom event for new records in the CFT. Once that particular field is created/modified,  go through the validation steps and then trigger error messages, send streams/emails or whatever you are tying to do.

 

Regards, Callum

Badge +1

Hi,

I use a modification of the template and the package custom_obj_sys.

Here the preparation:

I created a new template_id SWWCustomLuPackageBody as a copy from CustomLuPackageBody. Btw: SWW is a shortcut for our company ;-). I modified the template like this:

 

My template SWWCustomLuPackageBody

 

Then I modified the package custom_obj_sys.gen_apy_code___ to use my template.

Custom_Obj_Sys.Gen_Apy_Code___

 

and at the end of the procedure I go to my own procedure Replace_Tag.

Custom_Obj_Sys.Gen_Apy_Code___ at the end

 

SWW_Custom_Obj_Sys.Replace_Tag

In Replace_Code__ the comment inside the template will be removed.

SWW_Custom_Obj_Sys.Replace_Code__

 

That’s all for the preparation.

 

And now the explanation what happens using an example:

I create a custom LU named AEBComplianceCheck and I want a validation check before insert. The name of the package is AEB_Compliance_Check_Clp.

Now I create a package named AEB_Compliance_Check_SWW_Clp and add a procedure Before_Insert___.

Package AEB_Compliance_Check_SWW_Clp

 

 

And now here is the clue.

If the custom LU will be recreated by using the procedure Custom_Obj_Sys.Gen_Apy_Code. But now it is using my template (with my modification) and the procedure Replace_Tag will check if there is a package similar named like the LU package but with ..SWW_Clp and lookup for a an equal procedure name. If the procedure exist in ...SWW_Clp the comment in the template will be removed and replaced with my own package_name. That’s it.

 

Package AEB_Compliance_Check_Clp

 

And now every new creation of the custom LU has no effect on my validation check.

 

I use it often and I use it for custom fields also (with another template of course ;-).

 

 

I hope my explanation is understandable ;-)

 

Regards,

Burkhard

 

 

 

Badge +2

Hi,

I use a modification of the template and the package custom_obj_sys.

[..]

I hope my explanation is understandable ;-)

 

Regards,

Burkhard

 

 

 

 

Hi Burkhard!

 

Thanks for this, your idea is close to what I was thinking abour, however, is updating custom_obj_sys package allowed under IFS License Agreement?

 

Regards,

Rafal

Badge +2

You could control the validation using a custom event for new records in the CFT. Once that particular field is created/modified,  go through the validation steps and then trigger error messages, send streams/emails or whatever you are tying to do.

 

Hi Callum,

 

this looks like a great idea without touching the core code as Execute Online SQL seems to accept anonymous PL/SQL blocks. Thank you!

 

regards,

Rafal

Badge +1

frankly speaking: I don’t know really. I hope with the modification reply I don’t run into trouble :rolling_eyes: .

 

Actually I know two ways:

  1. Report the modification to the harvest system at IFS or
  2. Replace your modification at every update of Apps

Regards,

Burkhard

 

 

Userlevel 2
Badge +4

frankly speaking: I don’t know really. I hope with the modification reply I don’t run into trouble :rolling_eyes: .

 

Actually I know two ways:

  1. Report the modification to the harvest system at IFS or
  2. Replace your modification at every update of Apps

Regards,

Burkhard

 

Hi,

Just as a brief note on this discussion, it is not allowed to edit CORE IFS code and it will likely invalidate your support agreement should any issues occur due to it. I would recommend you do not go down this route.

If you need a change to the CORE part of the application you should do this as a formal modification so that you are sure you don't have any problems with your installation and its support.

The custom package will always be overwritten when recreated so putting a code change in there is not practical, CallumW’s suggestion seem to me to be a valid suggestion that works without introducing undue risk to your IFS installation.

 

Kind Regards,

Andreas

 

Badge +1

Thank you for your reply. I will heed your advice.

 

Best regards,

Burkhard

Reply