The Infor Communities is globally accessed system by Infor and its customers, please do not post or upload any content that could be deemed as sensitive, confidential or subject to any data regulation requirements. If you are unsure whether or not the content contains sensitive, confidential or has any data regulation requirements, please seek the advice of your internal security, legal, and compliance experts.

Extensibility framework - Copy button

Hi

I am trying to show a reminder popup for end users when they create an asset, so that the do not forget to create a meter for the new asset.

I have added handling for pressing the 'New' button, but as it is common to use 'Copy' to get most values filled in on the asset, i want to add handling to the Copy button as well.

Is there an event to capture for this as well ?

I do not want to use Save as that also requires my to solve finding out if there is a meter and not remind on all save events.

Unless someone is kind enough to solve that for me :-)

  • You can put an event handler on any object on the screen, including the save and copy button.
    You can also query the meter table as part of your save/copy event.

    Contact me privately michael.snyder@stratumcp.com

  • What is the event for copy button then? According to documentation from Infor on EAM Extensibility Framework there is no event for Copy. I have used 'afternewrecord' for New. 
    Or do I have to add my own event to the Copy Button ?

    I think i can access the meter grid with Ajax-call and send the assetid from the form as a filter value to get a count of meters, to know if there is at least one meter created.

  • Hi, is Michael suggesting you put a regular javascript event handler on the copy button, rather than use the eam events?

    Thinking about user workflow, are you trying to prevent users from copying a donor record that doesn't have a meter?  Would you not normally have ensured they have a meter in your process?

    It might be more straightfoward to go for an after update Flex ... ?

  • I have this same question.  I have a custom screen that I want to blank out some fields when a user copies a record.  I can't seem to find a trigger for it.  I tried aftercopyrecord just to see if it would work but it doesn't.  I also found beforetoolbarclick:

    '[extensibleFramework]': {
                    beforetoolbarclick: function(screen, action) {
                        console.log('beforetoolbarclick');
                        console.log(screen);
                        console.log(action);
                    },
    }

    Which triggers fine, but aftertoolbarclick doesn't seem to work either.

  • My template for toolbar clics, so far, is
    --
            '[extensibleFramework]' :
            {
                beforetoolbarclick: function(screen, action) {
                  var screenClassName = '';
                  try {screenClassName = Ext.getClass(screen).getName()} catch(e){console.log(e)};
                  var screenControllerClassName = '';
                  try {screenControllerClassName = Ext.getClass(screen.getScreenController()).getName()} catch(e){console.log(e)};
                  var tab = null;
                  try {tab = screen.getCurrentTab();} catch(e){console.log(e)};
                  var tabClassName = '';
                  try {tabClassName = Ext.getClass(tab).getName()} catch(e){console.log(e)};
                  var tabName = '';
                  try {tabName = tab.tabName} catch(e){console.log(e)};
                  console.log('beforetoolbarclick'
                    + '  screen: >'     + screenClassName           + '<'
                    + '  controller: >' + screenControllerClassName + '<'
                    + ', tab:>'         + tabClassName              + '<'
                    + ', tab name: >'   + tabName                   + '<'
                    + ', action: >'     + action                    + '<');

                  // HDR, CMT : commenti, DOC : documenti, LST : griglie
                  switch(action) {
                    case 'copyRec':         //  Copia record (Ctrl+F)
                    case 'deleteRec':       //  Elimina recod (Ctrl+D)
                    case 'enterDesigner':   //
                    case 'help':            //
                    case 'nextRec':         //  Record successivo (Ctrl+giu)
                    case 'newRec':          //  Nuovo record (Ctrl+N)
                    case 'previousRec':     //  Record precedente (Ctrl+freccia su)
                    case 'printRec':        //  stampa
                    case 'printPreviewRec': //  anteprima di stampa
                    case 'resetRec':        //  ripristina
                    case 'saveRec':         //  Salva record (Ctrl+S)
                      /* return false; */   // blocca l'azione corrente
                      break;
                    default:
                      // screen : "EAM.view.administration.costcode.bscstc"
                      console.log('action :>' + action + '< non gestita nel template');
                  }
              }
              // aggiungendo un documento in DOC
              // attivando lo screen designer
              // aprendo il lancio schermata CTRL+F2  
              , activate:           function() {console.log('activate');}
              , deactivate:         function() {console.log('deactivate');}

              , beforecopyrecord:   function() {console.log('beforecopyrecord');}
            }
    --
    in HDR I've not found any event for copy.
    Instead I intercept : afterrecordchange and afterloaddata .
    So when user copy a record I see
    --
    beforetoolbarclick  screen: >EAM.view.equipment.position.osobjp<  controller: >EAM.controller.equipment.position.osobjp<, tab:>EAM.view.common.RecordView<, tab name: >HDR<, action: >copyRec<
    beforecopyrecord
    HDR afterrecordchange
    HDR afterloaddata
    --
    Bye,
        Davide

  • That makes sense.  But afterrecordchange and afterloaddata won't work for me because those are triggered when changing records.  I only want to blank out some fields when a user is creating a new record via copy.

  • I copied&pasted the console log after a copy, so they are called.
    If you find some call returning the record's current status (new, modified, ...) you've finished.
    otherwise you could set a flag for this screen after the toolbar copy event & handle it in one of 2 'after*' event.

  • ... looking into unminified app.js I just discovered something like

        EAM.Utils.getCurrentTab().isCopyRecord()

    that return true if just copied and undefined for empty or plain records.

    "your mileage may vary" - undocumented as usual - wrap with try-catch.

  • I got it working.  I ended up using a flag like you mentioned - I only just discovered where the variable declaration needs to be in order to persist between calls.  I also decided to use beforenewrecord to get what I'm looking for.  Rather than blank a lot of fields out with a copy record call, I retained a couple with a new record call.  If anyone needs it, below is the code I used to retain a couple fields when clicking creating a new record.  Note that this example is for a user defined screen, RUBDCT.  Thanks for the help Davide!

    Ext.define('EAM.custom.external_rubdct', {
        extend: 'EAM.custom.AbstractExtensibleFramework',
        getSelectors: function () {
            var fields = {};
            var newFlag = false;
            return {
                '[extensibleFramework] [tabName=HDR][isTabView=true][userFunction=RUBDCT]': {
                    beforenewrecord: function() {
                        var vFormPanel = EAM.Utils.getCurrentTab().getFormPanel();
                        fields.store = vFormPanel.getFldValue('wspf_10_bld_store');
                        fields.bin = vFormPanel.getFldValue('wspf_10_bld_bin');
                        newFlag = true;
                    },
                    afterloaddata: function() {
                        if (newFlag) {
                            newFlag = false;
                            var vFormPanel = EAM.Utils.getCurrentTab().getFormPanel();
                            vFormPanel.setFldValue('wspf_10_bld_store',fields.store);
                            vFormPanel.setFldValue('wspf_10_bld_bin',fields.bin);
                        }
                    }
                }
            }
        }
    })