Fulfiller Mandatory Questions in Catalog Item

kailashthiyagar
Kilo Guru

I have a catalog item and there are 3 variables which will be visible and mandatory after the submit of the request. The person who is going to work on the task, has to fill the values in it .

I m using the below script on load and made it as "Applies on Requested Items/Tasks" and on "Catalog view". The questions appear as mandatory after submit of the request with this script. i m not able to save the RITM without entering any values for these variables. But if i close the task, the RITM is getting closed..

How to handle this scenario

var isAdmin = g_user.hasRole('admin');

  var isCatalogMaster = g_user.hasRole('catalog_master');

  if (isAdmin ||   isCatalogMaster) {

  // alert('Current user is an admin');

  //g_form.setVisible('current_priority', true);

  g_form.setMandatory('quality_standards_outcome', true);

  g_form.setMandatory('performance_standards_outcome', true);

  g_form.setMandatory('security_standards_outcome', true);

  }

  else

  {

  g_form.setMandatory('quality_standards_outcome', false);

  g_form.setMandatory('performance_standards_outcome', false);

  g_form.setMandatory('security_standards_outcome', false);

  }

1 ACCEPTED SOLUTION

Hi Kailash,



There is a column Global, not visible on form.


Add it to the list view and mark these variables global.


They are important on the catalog task, because an engineer would look at task and not the RITM, while fulfilling a request



find_real_file.png



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

24 REPLIES 24

Ivano B
ServiceNow Employee
ServiceNow Employee

Hi Kailash



I would suggest to have a look to the workflow you have on the item.


Maybe you have something over there that will automatically close the item when all the tasks are completed.


If you don't find anything on the workflow than I would suggest to have a look on the business rules.



I hope this will help or answer your question and if it does please mark it



R0b0


Actually i have "Wait for all task to complete" condition in the workflow which is closing the RITM....I can add a "if" condition in the workflow to avoid closing of the RITM.. so in that case, task will be closed but RITM will be open. Is it the right way?


You are checking the condition in weather tasks are closed or not in workflow, if condition false until the task should be closed.



In the workflow make the set value of RITM closed completed, when the all tasks are closed(if statement true) create on setValues acticity, it automatically close the RITM as well, why because workflow run on sc_req_item table only.



so create one setValue activity. below the if --- true.


in that set state --> closed complete


balajireddy


But i dont want to close the RITM until the answers are filled...


kailashthiyagar
Kilo Guru

sanjivmeher I added the variables on the task on the form and made it mandatory using the below client script and made it to "Applies on Catalog Tasks" to enforce the user to update those questions.. As a result of this, i m not able to assign tasks as well.. I can remove the checkmark "Applies on Catalog Tasks" but in that case if the user closes the task without entering the values for it, then it will get saved and ultimately closes the RITM..



if (isAdmin ||   isCatalogMaster) {


  // alert('Current user is an admin');


  //g_form.setVisible('current_priority', true);


  g_form.setMandatory('quality_standards_outcome', true);


  g_form.setMandatory('performance_standards_outcome', true);


  g_form.setMandatory('security_standards_outcome', true);



  }


  else


  {


  g_form.setMandatory('quality_standards_outcome', false);


  g_form.setMandatory('performance_standards_outcome', false);


  g_form.setMandatory('security_standards_outcome', false);


  }