UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Ensign
Ensign
233 views

UI rule to show message for only one specific button

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Captain
Captain

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

 

 

 

View solution in original post

3 Replies
Captain
Captain

1, Use workflow commands to set the flag of 'abc' when there are open issues.

2, clear the flag with 'Apply Before Save' SQL Rule

Still there will be message popup when page is refreshed, but I think it's acceptable.

0 Likes
Micro Focus Contributor
Micro Focus Contributor

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!

Captain
Captain

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

 

 

 

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.