UI rule to show message for only one specific button

Need to write a rule for one specific action (APPROVE button) action button

Requirement : If Project having open associated issue and user click APPROVE button to close the project , It will redirect to same page and pop up one message to close the open issue.

I have created  a field which will store "abc" as message in APPROVE Button path and in UI Rule (On Page Load ) i have given the condition that filed should store "abc" message . in other 4 action button i am removing "abc" message using command , so Popup message is not appearing for other 4 buttons as Rule condition is not satisfied.

Rule is working fine for all action buttons but problem is that when user click approve button for project having open issue it is redirect same page with pop up message but after whenever the page is refresh or click save button that message is also populating because rule is set on On page load and field have "abc" message. both the condition is satisfying in Save button and when page is refreshed.

My query is how to clear the message in the filed on Decision step, so that pop up message will not populate on Save button and on Refresh the page (i.e on page load).

Parents
  • Hi,

     

    You can try to create a custom UI rule in the "RequestRulesUserLibrary.js" like this one:

    --

    function showMessageForButton(button, message, continueProcessing)
    {
      if (document["rdf"]['STEP_NAME'].value == button) {
        alert(message);
        this.CONTINUE_PROCESSING_RULE = continueProcessing;
      }
    }

     

    For the "button" parameter you will use the actual button label (not the invisible part). "Message" will be your alert message text.

    Hope it helps!

  • Verified Answer

    This function is great.

    I made a slight modification to make it work for code instead of meaning.

    function showMessageForButton(button, message, continueProcessing)
    {
        if (decode(document["rdf"]['RESULT_VALUE'].value) == button) {
            alert(message);
            this.CONTINUE_PROCESSING_RULE = continueProcessing;
        }
    }

    Meanwhile, I think oshan2 wants to check project issues before closing project.

    So the solution is to make 2 "before transition" rules.

    1st. SQL Rule

    Before Transition

    Condition: Request No. contains any value

    Result Fields: "FLAG" (a hidden numeric textfield)

    SQL:

    select count(*) from kcrt_requests kr, KCRT_FG_MASTER_PROJ_REF km,
    KCRT_FG_PFM_PROJECT pr
    where KR.REQUEST_ID = km.request_id and km.REF_MASTER_PROJECT_ID = pr.PRJ_PROJECT_ID
    and pr.request_id = [REQ.REQUEST_ID] and STATUS_CODE not in ('CANCELLED', 'CLOSED_SUCCESS', 'CLOSED_FAILURE')

    2nd UI Rule

    Before Transition

    Condition: FLAG <> '0'

    showMessageForButton('APPROVE', 'Please close open issues', false);

     

     

     

Reply
  • Verified Answer

    This function is great.

    I made a slight modification to make it work for code instead of meaning.

    function showMessageForButton(button, message, continueProcessing)
    {
        if (decode(document["rdf"]['RESULT_VALUE'].value) == button) {
            alert(message);
            this.CONTINUE_PROCESSING_RULE = continueProcessing;
        }
    }

    Meanwhile, I think oshan2 wants to check project issues before closing project.

    So the solution is to make 2 "before transition" rules.

    1st. SQL Rule

    Before Transition

    Condition: Request No. contains any value

    Result Fields: "FLAG" (a hidden numeric textfield)

    SQL:

    select count(*) from kcrt_requests kr, KCRT_FG_MASTER_PROJ_REF km,
    KCRT_FG_PFM_PROJECT pr
    where KR.REQUEST_ID = km.request_id and km.REF_MASTER_PROJECT_ID = pr.PRJ_PROJECT_ID
    and pr.request_id = [REQ.REQUEST_ID] and STATUS_CODE not in ('CANCELLED', 'CLOSED_SUCCESS', 'CLOSED_FAILURE')

    2nd UI Rule

    Before Transition

    Condition: FLAG <> '0'

    showMessageForButton('APPROVE', 'Please close open issues', false);

     

     

     

Children
No Data