Edit variables on a catalog task after submission

Cat Scarberry
Tera Contributor

I have a catalog task that is partially filled out by the customer. The customer submits the request and it is routed to another person/group (field support). Once the field support receives the task I need them to fill in the other variables on the task

I have tried all kinds of combinations on the permissions for the variable and test it the variables are still read only?

Create Roles: User who can create values to the variable. If the user doesn't have the role mentioned, the variable will be read only before submission

Read Roles: User who can see the variable. If the user doesn't have the role mentioned, the variable will not be shown to the user

Write Roles: User who can edit the variable. If the user doesn't have the role mentioned, the variable will be read only in the variable editor

I have a lot of variables that need to be edited by the field team so I would rather not create a client script for each of the variables.


Anyone have any suggestions?

6 REPLIES 6

Hi @Cat Scarberry ,
I have mentioned about write ACL  on sc_task table

(Write ACL allows the user with Write access to write to an existing record, i.e. updating a record)
This contains roles "sn_request_write", "itil" who can update the task form.

Please check whether you have these roles and test.

 

 

Please mark it as correct and helpful,

 

Regards,

Shiva Kumar

 

Community ques.png

Constantine Kr1
Giga Guru

Hi Cat, 

 

I have tried this setup in an OOB (Out Of Box) PDI (Personal Dev Instance) and was able to get the desired functionality to work by using the "Read, Write, Create" roles on the catalog item variable properties/permissions.  Please try recreating this in an OOB instance, and if the issue persists, please let us know. 

 

Background: 

There is a client script on the sc_task table that marks all the catalog item variables as read only. Note: Catalog Item variables do not live on the sc_task table, but elsewhere in the system. Due to this, any client scripts, business rules, or ACLs defined at the sc_task table will not have any impact on the catalog item variables. 

Client Script Name: Variable Editor Readonly

Client Script Code: 

function onLoad() {
    g_form.setVariablesReadOnly(true);
}

This OOB code will set all the catalog item variables to Read Only (Note: this does not affect any variable defined on the sc_task table.... just catalog item variables). The exception, is if you have defined a role in the catalog item variable for Read, Write, Create.  Typically, most common is to add a write role so that only ITIL agents can modify specific fields. 

 

UI Formatter / Variable Editor:

Catalog item variables are shown by a UI formatter called "Variable Editor" (Note: for other tables like incident and change, there are formatters called Incident Variable Editor and Change Variable Editor). The client script mentioned above affects the variable editor. Please make sure by configuring the form layout on the sc_task that you see "Variable Editor" in one of the display sections.

More details on editors: 
https://docs.servicenow.com/bundle/utah-servicenow-platform/page/product/service-catalog-management/... 

 

Other Notes:

ITIL agents should modify these variables in either the agent workspace or default/native view in ServiceNow. Modifying catalog items in the service portal is not a best practice. This link from ServiceNow discusses this in detail: 

https://docs.servicenow.com/bundle/utah-servicenow-platform/page/product/service-catalog-management/...

 

Please let us know if the behavior doesn't work as expected. If all else fails, you can write a catalog item client script for catalog tasks and do something like: 

g_form.setReadOnly("catalog_variable_text_value", false);