Catalog Client script not working

Gemma4
Mega Sage

Hi everyone,

If possible can I please get some expertise on what might be causing a conflict with my catalog client script. Attached and below are the details. I have duplicated this in my pdi and it is working as expected and making the field mandatory. However, when this is in our dev instance it is not making the field required. I checked the other ui policies to see if there is a conflict but I'm not finding anything. I really didn't want to have to recreate everything and was curious if there was a way to determine why it isn't working in my dev instance. 

thank you in advance for any feedback you can provide!

 

//Karen has the role PM and mandatory fields are not required for her
//PM role also displays visiblity to modules
//Users with PMSubmitter role will be required to complete Mandatory fields

function onLoad() {

 


// if (g_user.hasRole('pmsubmitter')){
if (g_user.hasRoleExactly('pmsubmitter')){

// g_form.setDisplay('effort_estimate', false);


// g_form.setMandatory('business_need', false);
g_form.setMandatory('business_need', true);


}


else{


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


// g_form.setMandatory('business_need', true);
g_form.setMandatory('business_need', false);

}

 


}

 

 

 

2 ACCEPTED SOLUTIONS

Prince Arora
Tera Sage
Tera Sage

@Gemma4 

 

I can observe few points:

 

  • When using the Service Portal, please choose "All" as the UI type instead of "desktop."

  • If there are numerous client scripts on the form, deactivate them all by setting "Active" to "False." Test if your client script functions correctly this way. Then, activate them one by one to identify the problematic one.

  • Ensure that the user has the "pmsubmitter" role.

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

 

 

View solution in original post

Hello @Prince Arora 

 

I took your advice and made the following changes as you suggested but still have no luck. 

 

  • changed "All" as the UI type instead of "desktop."

  • There were 2 other client scripts and I marked them inactive. Marked each one inactive, tested and even with both inactive  still having an issue

  • ensured my test users have the new role "pmsubmitter". I even created a new role pm_user, added it to the script and added access to the user and no luck. 

Do you have any other ideas. I have several ui policies and business rules but they all appear to look good. 

 

View solution in original post

5 REPLIES 5

Gemma4
Mega Sage

Thanks everyone for the feedback. I moved the change to my test instance and the script below worked perfectly. I believe some of the following changes I've made in dev our causing a conflict. Just wanted to share in case anybody else is having the issue. thanks again for all the help!!

 

 

//Karen has the role PM and mandatory fields are not required for her
//PM role also displays visiblity to modules 
//Users with PMSubmitter role will be required to complete Mandatory fields
 
function onLoad() {
 
 
 
 
 
//  if (g_user.hasRole('pmsubmitter')){
//  if (g_user.hasRoleExactly('pmsubmitter')){
if (g_user.hasRoleExactly('pm_user')){
//  g_form.setDisplay('effort_estimate', false);
 
 
//  g_form.setMandatory('business_need', false);
  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);
 
 
  }
 
 
  else{
 
 
 // g_form.setDisplay('effort_estimate', true);
 
 
//  g_form.setMandatory('business_need', true);
  g_form.setMandatory('business_need', false);
g_form.setMandatory('effort_estimate', false);  
g_form.setMandatory('objectives', false);  
g_form.setMandatory('key_deliverables', false);
    g_form.setMandatory('key_dependencies', false);
    g_form.setMandatory('assumptions', false);
    g_form.setMandatory('constraints', false);
    g_form.setMandatory('risks', false);
    g_form.setMandatory('out_of_scope', false);
    g_form.setMandatory('workaround_identified', false);
    g_form.setMandatory('resource_requirements', false);
    g_form.setMandatory('estimated_costs', false);
    g_form.setMandatory('project_manager_assignment', false);
 
 
 
  }
 
 
 
 
}