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 :-)

Parents
  • 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);
                        }
                    }
                }
            }
        }
    })
Reply
  • 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);
                        }
                    }
                }
            }
        }
    })
Children
No Data