Forcing a view and script if certain conditions are met.

Mike Pottorf
Tera Contributor

Hello,

I am currently experiencing some problems trying to hide the resolve button, on the incident form,   when the user is forced into the self-service view.   We have created two self-service forms, through the record producer, that all users, ESS or ITIL, have access to submit.   I only mention that ITIL and ESS both use the forms as I don't see a way to accomplish this using view rules or a UI action that would be conditional on roles.   I was initially able to accomplish this with a UI Policy with the conditions of 'Contact type' is 'self-service' applied only on the ess view which would run the following script:

function onCondition() {

var items = $$('BUTTON').each(function(item){

    if(item.id != 'sysverb_update' && item.id != ''){

          item.hide();

    }

});

      }

This will work but requires that I display the 'Contact type' field and Incident Variable Editor on the form.   I am not sure why it requires the Incident Variable Editor to work but we don't want to display the forms variables which us leads us to this problem.   If anyone has experienced a workaround, or any other solutions, I would be glad to hear them.

Thanks,

Mike

2 REPLIES 2

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Michael,



Can you try to reproduce this on any demo instance so that we can take a look.


Alternatively you can write a client script to do the same.


Mike Pottorf
Tera Contributor

I could try to reproduce that for you.   Could you point in the direction of a demo instance.



For the client script.   I have looked into that and haven't found any clear cut solutions.   It seems that forcing a view is done through a business rule, not a client script.   Since I need the script to have multiple conditions, that are contingent on the form, I'm not sure that I could do that through a business rule.   If you have any suggestions for how to force views using a client script I would appreciate it.   Thanks.