The CreatorCon Call for Content is officially open! Get started here.

Applying UI Policies to Variable Editor

ljschwaberow
Giga Expert

I read the post below regarding adding a Business rule and Client script to filter out empty variables, so they won't show up under Variable Editor. UI policies on record producers should be applied on incident form variable editor. This works great if you have a free form text field. However, most of my UI policies apply to Yes/No Variables showing up under certain conditions. Such as:

If 'My Computer' is selected from a list, a 'Are you having a problem with a specific applications?' shows up with Yes/No choices. Is there any way to keep this field from showing up on the Variable Editor if say 'My Printer' is chosen in the beginning instead of 'My Computer'?

1 ACCEPTED SOLUTION

Yes, basically you build an if on the "request_type" you provide.



So in my example, we have a record producer that firsts ask the user what type of issue they are having:



emailtype.png



Then based on how they answer this question we ask them some additional questions.   Most are not related at all to email.   Then in the script section I have created an if for each value if they have answered Desktop, Email, Printer or Phone.   And based on how they answer those questions, I populate the correct information into the work notes.



Here is a full snippet of the code that just handles that:



recordproducercode.png



The final line of code basically would be the following:



current.work_notes = descriptionarray;


View solution in original post

14 REPLIES 14

Thank you for your help bburdickThis is exactly what I've been working on. I currently have all the fields transferring to the Work Notes. Would I just need to use scripting similar to what you provided to limit what fields transfer if questions are answered a certain way. Such as in your posting in that link - I would only want those questions to transfer to the Work Notes if they stated they were having an e-mail issue. Would I just need to build a script for each set of questions? I guess that's the step I am still missing.


Yes, basically you build an if on the "request_type" you provide.



So in my example, we have a record producer that firsts ask the user what type of issue they are having:



emailtype.png



Then based on how they answer this question we ask them some additional questions.   Most are not related at all to email.   Then in the script section I have created an if for each value if they have answered Desktop, Email, Printer or Phone.   And based on how they answer those questions, I populate the correct information into the work notes.



Here is a full snippet of the code that just handles that:



recordproducercode.png



The final line of code basically would be the following:



current.work_notes = descriptionarray;


This makes sense but I'm wondering does this take place of the Business Rule I have in place to copy variables to Work Notes? I've tried removing my current Business Rule to see if the one with code similar to what you have provided will work and nothing copies over at that time. However, if I use them together it's still not leaving at the irrelevant fields.


Yes, it should take place of the business rule to copy the variables in the work notes.



The script for the solution I provided should reside in the script section within the Record Producer.   If the information is not passing into the work notes there is probably an error in the script that is not being caught.



For example, I had an issue with displaying the reference variable field on that record producer for computer.   However when I first wrote the script like this:



descriptionarray += producer.computer.getGlideObject().getQuestion().getLabel() + " " + producer.computer.number + "\n";



It would not display the information at all. I had to pull the bold/italicized piece out and hard code the name of the label instead of allowing it to be dynamic:



descriptionarray += "Computer: " + producer.computer.name + "\n";


Ok, I'm at least on the right track now. I inactivated the other business rule I had and moved this to the record producer. It's still not currently transferring but I'll review my script or try hard coding the name. Thanks for help.