Why is Mandatory field in UI policy actions read-only in Scoped application?

Priya Shekar
Giga Guru

Any reason why Mandatory field in UI policy actions is read-only in Scoped applications..

1 ACCEPTED SOLUTION

Hi All,



Got solution for this issue.


1. We can make a field mandatory created within the scoped app thro client scripts, regardless the table created within the scope or not.


2. We can make a field mandatory created within the scoped app thro UI Policies, only when the table is also created within the scope.



Thanks,


Priya


View solution in original post

15 REPLIES 15

Thanks for the update. I can confirm that this is not the OOB behaviour.


Right click on the mandatory field and make sure that it is not set read only from the dictionary.


I checked in Dictionary, it is not set to read-only.


This is the onload client script written in UI policy action table


function onLoad() {
limitUIPolicyActionsOnLoadOnOutOfScopeTables();
}


function limitUIPolicyActionsOnLoadOnOutOfScopeTables() {
var tableName = g_form.getValue("table");
if(!isTableInScope(tableName)) {
  g_form.setReadOnly("mandatory",true);
} else {
  g_form.setReadOnly("mandatory",false);
}
}


function isTableInScope(tableName) {
if(tableName == "")
  return true;
var allowedTables = g_scratchpad.inScopeTableList;
for(var i = 0;i<allowedTables.length;i++) {
  if(allowedTables[i] == tableName) {
    return true;
  }
}
return false;
}



-------------------------------------------------------------------------------------------------------------



Scratchpad variable is defined in the below script:



var FetchAllowedScopedTables = Class.create();


FetchAllowedScopedTables.prototype = {


initialize: function() {


},




fetchAllowedScopedTables: function () {


  var scopedTables = GlideSystemUtilDB.getInScopeTables();


  var allowedTables = [];


  var numScopedTables = scopedTables.size();


  for(var i=0; i<numScopedTables; i++)


    allowedTables.push(scopedTables.get(i));


 


  var scopedDBViews = GlideSystemUtilDB.getInScopeDBViews();


  var numScopedDBViews = scopedDBViews.size();


  for(var i=0; i<numScopedDBViews; i++)


    allowedTables.push(scopedDBViews.get(i));


 


  g_scratchpad.inScopeTableList = allowedTables;


  g_scratchpad.isGlobalScope = !GlideSystemUtilDB.isScopedApp();


},




type: 'FetchAllowedScopedTables'


};



--------------------------------------------------------------------------------------------------------


In the above script if we see, all the scoped tables are stored in the scratchpad "g_scratchpad.inScopeTableList" .This is not allowing the mandatory field to be editable in UI policy action table.


I think that's causing the issue: the script. your setting the field values to read only. And your ui pol says to leave it alone.


These scripts are available in the Fuji instance by default. It is not created by any user.