'Edit request form' widget in service portal

Keerti2
Mega Expert

Hi All,

We have 'Edit request form' widget on portal , when we raising request  variables are working as expected ( based on Catalog ui policy and client script , some are visible , few are mandatory etc...) , 

But when i click on 'Edit request form'   its showing all variables (not worked ui policy/client script) , i want to hide few of variables  , here CATALOG UI POLICY or CLIENT SCRIPTs are NOT working , please find related screen shots and used widgets ...

Kindly help on widget to hide few variables on portal view ,   I'm using attached widget in CSM portal view , when i click on "Edit Request Form" button all variables appearing in editable view.

I want to hide few variables , kindly suggest me server script where can i add code to hide those variables

 

Catalog form showing on below url
https://instance.service-now.com/csm?id=csm_cat_item&sys_id=4ea0287adbc13b047654273605961978

 After click on 'edit form' button navigating to below url and appearing all variables

https://instance.service-now.com/csm?id=csm_request_edit&sys_id=aa7456f6db10d0d0765427360596190b&table=sn_customerservice_case

 

 

(function(){
var gr = $sp.getRecord();
var table = gr.getTableName();
data.canRead = gr.canRead();
if (!data.canRead)
return;

//determines editablity based on the request's stage
//request is not editable while pending approval or after being approved.
data.isEditable = checkStage(gr.u_stage);

var agent = "";
var a = $sp.getField(gr, 'assigned_to');
if (a != null)
agent = a.display_value;
var list = "approval";

var fields = $sp.getFields(gr, list);
if (gr.getValue("sys_mod_count") > 0)
fields.push($sp.getField(gr, 'sys_updated_on'));


data.tableLabel = gr.getLabel();
data.variables = $sp.getVariablesArray();
data.fields = fields;
data.approval = fields.approval;
data.table = table;
data.sys_id = gr.getUniqueValue();
})();

function checkStage(stage) {
var editableStages = gs.getProperty('custom.list.csm.request_editor.visibility_stages').toString();

if(editableStages.indexOf(stage) >= 0) {
return true;
}
return false;
}

 

 
  • DOC
5 REPLIES 5

Did you check the code above I added? Anyway, I have updated the code in the widget and attached. You need to add fields in the if condition in line no:102 in server script.

Please mark my answer correct if you are satisfied with the answer.