Can a end user (no ITIL access) update the variables after submission on the portal?

Gemma4
Mega Sage

Hello everyone,

I have a requirement for several catalog item variables to be completed by the end user after the request is submitted. I've tried making the variables mandatory with a client script and I gave the user a new role. However, the user can only edit the variables in the platform no matter what I attempt and not the portal. Below is the catalog client script I tried. Has anyone accomplished this or is there an easier way to achieve this? 

thanks in advance for any feedback you can provide. 

 

function onChange() {
//Type appropriate comment here, and begin script below

var ritmState = g_form.getValue('state');

if (ritmState === '9') {
g_form.setMandatory('test5', true);

//g_form.setDisplay('assigned_to', true);
}

if (g_user.hasRoleExactly("pmsubmitter")) {
g_form.setMandatory('test5', true);

//g_form.setDisplay('assigned_to', true);

}
}

2 REPLIES 2

ahmedkhan
Tera Contributor

This poses a series of problems to solve before you can accomplish what you are looking for.
For starters, there might be multiple RITM's under each REQ. And there will be multiple questions under each RITM.
Then there are different types of questions for each RITM.
You will need to create a custom widget to display and be able to edit all the answers.
I have provided a sample widget which can be placed under "order_status" page to display all the questions related to the RITM's under the REQ as text fields. I have not included the updating part)

Tables involved in this
sc_req_item
sc_item_option_mtom
sc_item_option

In case of record producers, you can find the questions and answers under the table question_answer.

Screenshot from 2023-09-14 13-59-44.png



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


Please mark the answer as helpful
And if you have a remote job for me, please let me know.


Thank you @ahmedkhan for all the feedback. Below is a summary of what I did to achieve this. Will you review this and provide your feedback if you feel this is a best practice or if you feel there may be issues down the road from this? Thanks so much for all your expertise. 

Requirement: 

End user without itil role submits catalog item and only completes order guide variables

Manager selects yes at variable "additional information" if they need user to complete more information

End user completes additional variables on catalog item, on portal that are required. 

 

Steps I completed:

Created Catalog UI Policy

when to apply: additional_information is yes

Applies on Catalog Item View, Requested Items, Onload and rever if false

Script: 

execute if true

function onCondition() {
//g_form.addInfoMessage("client script testing activated");
if (g_user.hasRoleExactly("pm_user")) {
// g_form.setMandatory('test5', true);
g_form.setMandatory('business_need', true);
g_form.setMandatory('effort_estimate', true);
g_form.setMandatory('objectives', true);
g_form.setMandatory('key_deliverables', true);
g_form.setMandatory('key_dependencies', true);
g_form.setMandatory('assumptions', true);
g_form.setMandatory('constraints', true);
g_form.setMandatory('risks', true);
g_form.setMandatory('out_of_scope', true);
g_form.setMandatory('workaround_identified', true);
g_form.setMandatory('resource_requirements', true);
g_form.setMandatory('estimated_costs', true);
g_form.setMandatory('project_manager_assignment', true);
}
}
 
Execute if false
Same as above but false added to replace true
 
ACL added
This was added to allow non itil users with PMSubmitter role edit variables
sc_req_item.variables 
Operation- write
type record