Allow Ui actions

XYD23
Tera Contributor

I have a table called Result in which all the info is stored in a field called Code.

requirement is to access Ui action on the incident form based results which is in code field. Else need to show up a error message and popup a window.

I guess this must be done using business rules

6 REPLIES 6

Hi @XYD23 

 

NOt sure, it so straight forward, bez we need to add condition on UI action and check json value.

 

@Anurag Tripathi any thoughts.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

SunilKumar_P
Giga Sage

Hi @XYD23, for the UI action visibilty you can call a script include to check if the code contains fabrication or not and based on the script include response, you can manage the UI action visibilty. Business Rule doesn't manage the UI actions visibility.

 

You can try the below method.

 

Script Include Name: showUIAction

Script:

 

var showUIAction = Class.create();
showUIAction.prototype = {
    initialize: function() {
    },

	getMakeName: function (jsonData){

var jsonObject;
jsonObject = JSON.parse(jsonData);

var containsFabrication = false;

for (var i = 0; i < jsonObject.length; i++) {
    var makeName = jsonObject[i].makeName;
    if (makeName && makeName.startsWith('Fabrication')) {
        containsFabrication = true;
        break;
    }
}

if (containsFabrication) {
    return true;
} else {
    return false;
}
	},

    type: 'showUIAction'
};

 

 

UI Action Condition

 

new global.showUIAction(current.u_code) == true

 

 

The pop-up functionality needs to be defined in the UI action client script and for that you may need the client callable script include where you parse the response as above and return the value and on UI action, use the glideajax method to get the script include output.

 

Regards,

Sunil