Script include on Incident form

YenGar
Mega Sage

Hello everyone,

I am having a hard time figuring out how to make this script include work in the incident form. Basically, I was asked to 'filter' the CIs when the caller is a specific person (ex: a store).

What I have done is the following:

-Created a check box field called "Is a store" in the incident form that is automatically check via a client script when the caller belongs to a group called "Store Users".

client script.PNGis a store.PNG

-Created (or attempted to create) a script include that looks at the 'is a store' checkbox in the incident form, if it is checked, it should only show the CIs marked with a class of "Store hardware" or applications marked as "Store Applications".

script include.PNG...

I also tried it this other way but didn't have luck either...

script include1.PNG

-Add the script include as 'javascript:getStoreCI() to the incident dictionary override to see if it would work but nothing is happening. I still see the same CIs as before.

override.PNG

This is not working for me as I thought it would... and I'm not sure what I'm doing wrong... does any one have an idea of how I can make this work? please let me know if I totally wrote wrong the script include and if i'm not calling it correctly in the dictionary override... I am stuck Please help!

Yeny

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Yeny,



The reference qualifier of the field should be 'javascript:scriptincludename.getStoreCI()


Replace scriptincludename with the name of the script include you have created.


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Yeny,



The reference qualifier of the field should be 'javascript:scriptincludename.getStoreCI()


Replace scriptincludename with the name of the script include you have created.


Hi Pradeep!



Thank you for your response! I tried what you suggested but it didn't work for me... I'm still able to see the full list of CIs and not the filtered list that I am trying to produce... Could it be that I wrote the script include wrong? Maybe I'm missing something... I'm not very big in scripting but I do my best... do you see anything in it that could be causing it not to work? The CIs I'm trying to populate are in different tables (for example: Store Hardware ('u_cmdb_ci_store_hardware') and Applications ('cmdb_ci_appl'))... Could that be a reason why?



Thank you so much!


Yeny


Hi Pradeep,



Thank you so much for taking the time to work with me and make the script work to how my customer needs it. So far, everything is looking good!



Thank you!


Yeny


Perfect


I am glad I can be helpful.