Intercept Action in custom inbasket

 4 Replies
 1 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
MarkH2002
Basic Member
Posts: 5
Basic Member
    I am trying to figure out how I can intercept the action being taken on an inbasket workunit and perform a test.  If the test = true the action will be taken, if false show an alert.  Similar to what you would do in design studio with OnBeforeTransaction. 
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      The following was provided to me by Jonathan Ford some time ago. It's for PFI and done within your Design Studio Portal Page.

      function portalpage_OnInit()
      {
      var navObj=portalObj.tabArea.tabs["PAGE"].getNavlet('inbasketActions')
           navObj.target = window
           //parameters below are 
      //1. Action id
      //2.Dispay Name in menu 
      //3. action
           navObj.changeItem("action0","Approve","parent.inbasketDoAction('Approve', '0')")  //parent.inbasketDoAction() is the built in Lawson function that is normally called
           navObj.changeItem("action1","Reject","reject1('Reject', '1')")
           
      }
      
      function reject1(action, row){
           var vRequester=page.parameters.RQH_REQUESTER
           var vRequisition=page.parameters.RQH_REQ_NUMBER
           var reason=prompt("Please enter the reason you selected " + action, "")
           reason = reason.replace(/[^a-zA-Z 0-9]+/g,'');
           //attach reason to workunit, or put it in a custom table with the requester/requisition variables so it can be read after the action node
           
      parent.inbasketDoAction(action, row);  
      
      } 
      David Williams
      jonathan ford
      Posts: 3

        Here it is without the single quotes encoded.

         function portalpage_OnInit()
        {
        var navObj=portalObj.tabArea.tabs["PAGE"].getNavlet(“inbasketActions”)
             navObj.target = window
             //parameters below are 
        //1. Action id
        //2.Dispay Name in menu 
        //3. action
             navObj.changeItem("action0","Approve","parent.inbasketDoAction(‘Approve’, ‘0’)")  //parent.inbasketDoAction() is the built in Lawson function that is normally called
             navObj.changeItem("action1","Reject","reject1(‘Reject’, ‘1’)")
             
        }
        
        function reject1(action, row){
             var vRequester=page.parameters.RQH_REQUESTER
             var vRequisition=page.parameters.RQH_REQ_NUMBER
             var reason=prompt("Please enter the reason you selected " + action, "")
             reason = reason.replace(/[^a-zA-Z 0-9]+/g,’’);
             //attach reason to workunit, add as comment, or put it in a custom table with the requester/requisition variables so it can be read after the action node
             
        parent.inbasketDoAction(action, row);  
        
        MarkH2002
        Basic Member
        Posts: 5
        Basic Member
          Thank you both for the reply.  I am actually using a custom .htm file and not a design studio form for this inbasket.  I thought the "command" in the user action node was meant for something like this just not sure how to use it.
          Ragu Raghavan
          Veteran Member
          Posts: 476
          Veteran Member
            portalObj.tabArea.tabs

            Can somebody tell me what the syntax in V10 is for this? It worked on V9. On V10, it barfs - "unable to get property 'tabs' of undefined or null reference'. Thanks.