PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09/13/2017 9:02 PM by  Ragu Raghavan
Intercept Action in custom inbasket
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages
MarkH2002
Programmer
SHC
Basic Member
(11 points)
Basic Member
Posts:5


Send Message:

--
11/19/2014 1:49 PM
    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
    Private
    Private
    Veteran Member
    (3061 points)
    Veteran Member
    Posts:1031


    Send Message:

    --
    11/19/2014 4:36 PM
    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
    Sr. Technology Consultant
    Avaap
    (9 points)
    Posts:3


    Send Message:

    --
    11/24/2014 7:31 AM

    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
    Programmer
    SHC
    Basic Member
    (11 points)
    Basic Member
    Posts:5


    Send Message:

    --
    11/24/2014 12:08 PM
    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
    Private
    Private
    Veteran Member
    (878 points)
    Veteran Member
    Posts:306


    Send Message:

    --
    09/13/2017 9:02 PM
    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.
    You are not authorized to post a reply.