Transforming the Grid Picker

1235

Comments

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Is there any cirteria that @SingleLineEntry will works? I place prompt only with @SingleLineEntry before textprompt and it won't works. Page can't load.
    I get an error in browser console

    /CustomSpace/custom_ROToolbox.js:238 Uncaught TypeError: $(...).keydowm is not a function    at forceSingleLineEntry (/CustomSpace/custom_ROToolbox.js:238)    at HTMLDivElement.<anonymous> (/CustomSpace/custom_ROToolbox.js:132)    at Function.each (jquery.min.js:3)    at init.each (jquery.min.js:3)    at transformRO (/CustomSpace/custom_ROToolbox.js:131)    at /CustomSpace/custom_ROToolbox.js:122
  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    Hi @Marek_Lefek ;

    Just reading the error message it looks like there is a typo in the code.

    keydowm should probably be keydown

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    @john_doyle that's right.
  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @Marek_Lefek ;  You have probably fixed it already, but I am attaching the corrected code for everyone else.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Thanks @john_doyle .
    Is there an option in @Autocomplete, to enable searching on all attibutes, not only firstone?
    eg. I have a promt for device(printer) with name (made by model and assettag) and serialnumber.


    Result - I can search only by name (1) and when search by  serial number (1) there are no results.

  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @Marek_Lefek
    The control works by passing the text input by the user into the criteria defined in the Request Offering. If you configure the Query Results prompt in the RO to search against multiple attributes it should also work in the Autocomplete control. So you need to define the Query Results prompt so that DisplayName contains the text field or Serial Number contains the text field.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    I thought that, but I can't make the OR condition in ConfigureCriteria. Always there is AND as in picture below.


  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @Marek_Lefek ;

    The UI is unfortunately a bit limited. You should however be able to build the RO with the AND condition, save it, and then export the Management Pack. Change the criteria in the MP, increase the version number and reimport it back into SCSM. The downside is that the UI will not show the edited criteria, so you do need to be careful when editing.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    We've had the need to merge multiple classes into a single multiselect option, which was not possible (even with the old grid pickers), so i've added another option to the toolbox, which allows you to get items related to selected items in a autocomplete/multiselect, and then add these related items to another autocomplete/multiselect.

    instead of trying to explain it again, here are the comments from the file explaining how to use it, then an example of how we are now using it on a form currently.

       @AddDataMergeProperty
    -----------
    @AddDataMergeProperty is used to set either a get data from or add data to option to a @MultiSelect and/or @AutoComplete
    this is then used to get data about related class items to any item(s) selected from one or more selections,
    and add these as extra items one or more @AutoComplete and/or @MultiSelect.
    The 2 Properties that should be used for this are "GetData" then a Unique Name, and "AddData" with a Unique Name or 'ALL'

    for example, if you wished to have a autocomplete or multiselect for computers, and then another which lists business services,
    but you also wanted to add any software that is installed on the selected PC's to the list of business services, you could do
    this by doing the following :
    1. Create a TypeProjection that gets software items related to computers (installed software), and find the ProjectionType GUID
    2. Add a @AutoComplete or @MultiSelect for computers to the ARO
    3. before the @AutoComplete or @MultiSelect add the following
    @AddDataMergeProperty {"Name":"Software","GUID":"90bc5c2b-c7b9-71f3-a4d8-3acaa565f9ab"}
    Note: The Name should be individual to the data retrieved from this selection, as you can retrieve data from multiple
    selections
    Note2: The GUID entered should be the GUID of the TypeProjection to use
    4. Add another @AutoComplete or @MultiSelect control, that can retrieve whichever class you wish to have and add the extra
    items to,
    NOTE: this can also be an enmpty class if you wish to create the entire list from related items in other @AutoComplete
    and/or @MultiSelect fields
    5. before the @AutoComplete or @MultiSelect that you wish to add the data to add the following
    @AddDataMergeProperty {"AddData":"Software"}
    NOTE: The name entered for the AddData is the name that was used to retrieve data, this is used so that there can
    be multiple retrievals and additions per page.
    NOTE2: there is a reserved name called "ALL" if this is used on the AddData then all items retrieved will be added,
    not just a spoecific named item.

    one of the forms we have this successfully running on is an Incident ARO which is used to report Software Issues. We have our business services setup, for web applications etc, which they need to be able to select from, but they also need to be able to select from software that is installed. but we decided that giving them a full list of software (including different versions) would make the list too long and confusing.

    so we have added a new projectiontype which just gets softwareitems related to a computer (which means it is installed on that computer) then on the form a MultiSelect for putting in the Computer Asset ID, and have the DataMerge attributes added to it, and another multiselect which is set on the aro to select Business Services , this 2nd aro had the adddata datamergeproperty added to it,

    so in the User Prompts of the ARO it looks like



    The GUID that is passed in the first @AddDataMergeProperty is the GUID of the TypeProjection we created to get the installed software on a pc.

    As the properties entered above are set, any computer assets entered into the first multiselect, are then checked to get a list of all software installed on any entered items. and then the adddata on the 2nd multiselect basically says to merge returned items into the 2nd multiselect.

    using the request offering on the portal ends up as the below

    no computers selected, the 2nd (business services) multiselect only shows business services as it normally would




    once a computer is added to the first multiselect, it also shows matching items of software actually installed on that computer (can be multiple computers added) as well as the business services the multiselect is setup to show



    yes i know it's a little complicated to explain, but can be used to make forms a lot easier for customers

    latest file attached (latest version is in GITHUB as well)

  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    Yet another option for the toolbox

    I've been working with @Ryan_Kennedy1 on this one, we had people complain that there was nothing to indicate how many characters they had to fill in on a field before being accepted when there was a minimum length set.

    we decided to have this display below the field where required, but also have the option of showing the amount of characters they had left after entering the minimum, this is tnhe result, comments from the file below to explain it, and a couple screen shots showing the results. latest toolbox version attached at the bottom.

    this option, if used, should be placed directly before the text entry on the request offering

    	@CharCount
    ----------
    Adds option for displaying the Minimum characters required and/or maximum characters remaining below a text area (input)

    By default the follow will occur:
    1 - if there is a minimum length, then it counts down while more characters are required, and displays this below the field
    2 - if there is a maximum length, and there is no minimum length, or the minimum length has already been reached,
    it counts down while more characters are available, and displays this below the field

    Available Options :
    showMin : true/false (default : true)
    enables or disables showing the minimum characters still required
    showMax : true/false (default : true)
    enables or disables showing the remaining characters available
    showMinMax : true/false (default : false)
    Shows both the remaining required AND remaining available character counts
    minText : The text to use in place of the default "Minimum Extra Characters Required"
    maxText : The text to use in place of the default "Maximum Characters Remaining"

    Examples :
    To show both Min and Max counts at the same time, and use different text
    @CharCount{"showMinMax":"true","showMin":"false","showMax":"false","minText":"MINIMUM REMAINING","maxText":"MAX REMAINING"}
    To show Minimum only , which no longer displays after the count is reached (default only needs to be over ridden)
    @CharCount{"showMax":"false"}

    NOTE : If there is no minlength or maxlength defined on the field, then it will not show even if the options are added from this entry





  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    In case I had not already said so in this thread, this is a truly inspired script and it has made a huge difference in the way we design our forms.

    Having said that, we are noticing that conditional show/hide of multiselect, single select, and autocomplete fields are permanently hidden when any type of logic is applied in the Layout section of an ARO.  Is anyone else noticing this, and/or is there a certain recommended technique to make sure that they are properly rendered when applying show/hide rules?

    It is entirely possible that I am missing something obvious, or something that may have been mentioned earlier in this thread, but I am not seeing it at the moment.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @Tom_Hendricks any chance you can send me a message with how you have what you are seeing setup.

    There may be some issues around the ordering of the extra  fields, i'll do a post in a bit showing the best order to have things in so they do not interfere with each other
  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @Tom_Hendricks ;  I suspected that there would be some complications with the Multipicker and the AutoComplete controls in the Layout as they were the first controls built for this library, and it was largely trial and error getting it to work with not too much thought given to the structure of the control.
    I will be creating an improved version of those controls which should not have the same compatibility problems. I just need to get some other work out of the way first.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Ok, thanks @john_doyle.  I would still be glad to PM you and @Jeff_Lang if either of you think it would be helpful.

    The general idea is that the controls work great if the ARO layout says "Always Show" next to them, but they are always hidden if "Show When True" or "Show When False" are applied.  It does not seem to matter if there are multiple controls or what order the conditionally shown controls are in relation to others, for example.

    However, I do not know this code like you do, so I would not be surprised to find anything that we have done is causing this, or that there is a way to work around it that I do not know about.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @Tom_Hendricks what version of the portal are you using, and are the conditionals set to Boolean  fields ?
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Portal: 8.2.2 (2016).  In most cases yes, we are using booleans.  We have tried other fields, however.  It does not seem to matter what our logical test is, just that we are attempting to perform one.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @Tom_Hendricks

    I see the issue already :)

    there appears to be an issue when using the Booleans on 8.2 with the toolbox. we currently have some working quite successfully on 7.4, but when we put it into our DEV environment which is 8.2 we started having the same/similar issues. on an initial check the criteria the ARO was putting out itself appeared to be wrong and not what we had selected in the ARO. I haven't looked into this fully yet, so not sure if a bug report needs to be filed.

    the particular instance we had was having 3 check boxes showing only, and as one was checked the other 2 would be hidden.

    for some reason when we had them set to "show when true", and the "question equal to false", the criteria ended up in the code on the portal as "show when not true" and the "question equal to false". this caused none of the fields to show at all.

    to get around it on our DEV system, i changed the criteria to "show when true", and the question to "not equal to true". this appeared to put the correct criteria out to allow the show/hide code in the toolbox to correctly work with it and show/hide the fields correctly. NOTE: this only modifies the Boolean criteria if there  is more than one criteria to process, if there is only the one Boolean on the grid view then no modifications are performed.

    I will be having another look at this, but you could try modifying the way you have the criteria set to get this working.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    edited January 30
    I was able to test right away, so I'm just editing my comment with the results.  This had no effect, unfortunately. 

    I'm trying to show a picker when a single boolean is true, so I changed the logic to be "Show When False" and "question not equal to true" (I think this kind of reverse logic counts as hazing the next person to try to modify the form, but I digress).  Just as before, other non-toolbox fields that test that same boolean show/hide as expected, but the picker is always hidden.

    I am only using the criteria in the ARO form, not any of the extra features in the toolbox pertaining to criteria.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @Tom_Hendricks
    i'll send you a private message so we don't fill up here with lots
  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    Hi Guys, this toolbox is great.

    I've been testing it in my lab and when i use the @autocomplete and @multiselect i cant get the filtering to work with our distribution lists it just gives me a full list, i think it may be because they all start with # 
  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    Also @john_doyle could the Datepicker utc function in this toolbox work around the issue i have logged with you? PR70630
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @David_Morris1 in the @AutoComplate/@MultiSelect, are you setting the filtering on the grid view to contain the token of the entry field between the grid view and @AutoComplete/@MultiSelect ?
  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @David_Morris1 ; that PR was the main reason for adding the UTC DatePicker control.
  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    @Jeff_Lang sorry totally missed that working now thanks
    @john_doyle I've added a tested the datepicker control with the UTC tag but this produces the same issue as before where if I enter a request from my machine UTC +0 on my cayman portal server UTC + 5 and put in a request at 00:00 this is saved into the system as 05:00 so is still based on the management server date not my date
  • john_doylejohn_doyle Cireson Support Ninja IT Monkey ✭✭✭✭
    @David_Morris1 ; I seem to be able to replicate what you are experiencing, but only intermittently and it seems only the first time I open the form. So it could be a timing issue and the date control is not being reliably replaced. I'll run a few more tests later.
  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    edited February 2
    @Tom_Hendricks @Jeff_Lang
    I can also confirm on 8.2 the issue with show/hide of autocomplete & multiselect

    I have removed the following section 

    //modify boolean criteria to take into account if booleans are null, false or true without needing to check/uncheck them if additional criteria added
    function modBoolCriteria(criteria) {
    	var criteriastart = criteria.lastIndexOf('(');
    	var criteriaend = ( criteria.length - criteriastart - 1);
    	if (criteria.substr((criteriastart - 1), 1) == "!") {
    		if (criteria.indexOf('false') > -1) {
    			criteria = criteria.substr(criteriastart, criteriaend);
    			criteria = criteria.replace('false', 'true');
    		} else {
    			criteria = '!' + criteria.substr(criteriastart, criteriaend);
    		}
    	} else {
    		if (criteria.indexOf('false') > -1) {
    			criteria = '!' + criteria.substr(criteriastart, criteriaend);
    			criteria = criteria.replace('false', 'true');
    		} else {
    			criteria = criteria.substr(criteriastart, criteriaend);
    		}
    	}
    	return criteria;
    }
    that was in there to handle Boolean's in 7.4 and can confirm that these two situations now work as expected without the need to check/uncheck them first

    Show on True Bool is equal True
    Show on True Bool is not equal True

    for me this covers all bases for for show and hide on Boolean
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    @David_Morris1 the version of the toolbox that can be downloaded does not use that bit of the code at all for @AutoComplete/@MultiSelect criteria merging. that was added for the @ShowHideCriteria* tags, although some changes i asked @Tom_Hendricks ; to make did set it to use that function, this made no difference for his setup it seems.
    I have managed to duplicate his error, but only on firefox, and it seems that what is causing it in my duplication is something completely different, as it only affects FireFox not all browsers like it does for @Tom_Hendricks
    We will get it sorted out though :)

    If the null values are working ok on 8.2, then taking the calls to that procedure out should work ok, not sure if we can add to the code itsel;f to only call it if the version is 8.2 or above though, even if it still gets called on 8.2 it should still work, we have a few requests using multiple check boxes to hide/display fiels that are using that part of the code that work quite sucessfully
  • David_Morris1David_Morris1 Member Advanced IT Monkey ✭✭✭
    emm thats really strange I definitely couldn't get it working on chrome before removing this section, no matter what combination just caused the controls to remain hidden when using the check boxes, even with this removed i can confirm that this is still the case in firefox only
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    hmm, i'll have to have another look at it then, but the AC/MS was definitely not calling it, and the check boxes work in 8.2 for myself in all but firefox, this ones a strange one
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Just to confirm what you said above, I see the same behavior in all browsers.
Sign In or Register to comment.