UI Actions - Wrong Button Appears When Reversing From Phase 2 into Phase 1.

ronro2
Tera Contributor

Hello Guys! 

I am facing an issue with two UI Actions regarding a pm_project table. Keep in mind that there might be some kind of overriding business rule somewhere or client script. 

I want to make sure that the button "Starta projektet" (Start project) to only appear when the record is just created in the Initiating phase. 

However, when an already opened project is in use and you reverse from phase 2 (Planning) into phase 1 (Initiating), the Start project button appears first, but it loops and then after pressing the "Start project", the right button appears (still in phase one), which is wrong according to new acceptance criteria.

I want the "Gå till planering" (Go to planning) button to be the ONLY button visibile on the upper right corner when you reverse from Planning to Initiating. 

I have attached some material for you. So first attatchement is the UI Action for initiating the project:

ronro2_0-1699011724443.png
Here comes the full condition (as not all of it is visible): 

current.state == '-5' && gs.hasRole('PMO') && !current.isNewRecord() && current.phase == 'initiating' ) || (current.isNewRecord() && current.canCreate() && current.phase == 'initiating') && current.u_type == 'project')

Here is the second UI Action for the planning phase button:

ronro2_1-1699011762563.png

And here is a link for the demo that illustrates how it loops when you reverse from planning to initiating: 
https://youtu.be/cy2-ZdY-6-0

Can you please help me? 

1 REPLY 1

yaswanthi2
Giga Sage

Hi @ronro2 

you can put condition on revert phase UI Action as 

current.phase == 'planning'  // as per your requirement add remaining condition

 

In script you can update in revert phase UI Action like below so this will move to initiating phase and as per go to planning condition you will get go to planning UI Action on the form

current.phase = 'initiating';
current.update();
var url = current.getTableName() + '.do?sys_id=' + current.sys_id.toString() + '&sysparm_view=';
action.setRedirectURL(url);