Transforming the Grid Picker

123457»

Comments

  • Rob_RadabaughRob_Radabaugh Customer IT Monkey ✭
    So I've used this feature in a few RO's with no issue but now, creating new RO's I can't get the user picker to work correctly. Existing RO's are fine but I've literally copied them or created them exactly the same and am running into the attached issue. Any Ideas? What am I missing? Thanks
  • Rob_RadabaughRob_Radabaugh Customer IT Monkey ✭
    And here is how I built it in the ARO

  • Steve_ClarkeSteve_Clarke Customer Adept IT Monkey ✭✭
    edited February 27
    Hi @Rob_Radabaugh. I think @Multiselect needs to be @MultiSelect (capital S as it is case sensitive).

    Edit. Yep. Confirmed in our test environment.
  • Rob_RadabaughRob_Radabaugh Customer IT Monkey ✭
    @Steve_Clarke Thanks! I actually had tried that but after your comment I just went back and deleted the line a recreated it and it worked. Now unfortunately I'm no getting the user picker to work. This is the first time I'm using multiple user pickers on the same screen and wondering if that's an issue. Can't get any of the three to pull results but my other RO's are still working. Thanks again

  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭

    There should be no issues using multiple @AutoComplete's and @MultiSelect's on a single ARO, and in some instances you can use what is entered on one of them to add extra items to another for selection as well.

    If you unload the ROToolbox does the grid view selection still work ?
  • Rob_RadabaughRob_Radabaugh Customer IT Monkey ✭
    @Jeff_Lang
    Thanks for responding. I was able to actually figure this one out and it was user error. I wound up recreating the RO and everything worked as intended. Thanks to everyone who has contributed to this project because it's been a great help! 
  • Gabriel_LencesGabriel_Lences Customer IT Monkey ✭
    edited March 16
    Hi everyone!
    We are trying out the RO toolbox in our environment and we're loving it! When I was thinking of the possibilities that could be done with the RO toolbox, I wanted to test out if @placeholder works with other types of prompts apart from the text fields. Yes, for queries you can certainly use the @autocomplete and @multiselect feature, but what about the date, simple list, integer inputs ? The @placeholder functionality doesn't seem to work there, which is a bummer! :(
    See the attachement - I have a @Placeholder above the date prompt named "when" in SCSM, but nothing shows on the portal. Same stuff goes for dropdowns as I pointed out.

    Is there any way this could be enabled on these types of inputs as well? Through this we would be able to create some really clean looking request offerings! :)
    Thanks in advance. 
  • Steve_XiongSteve_Xiong Customer IT Monkey ✭
    I found an issue with RO Toolbox. I believe isn't correctly handling and constructing 'contains' conditions in showing and hiding.

    Directly below is the error I get in my Chrome dev tool when I try to use @ShowHideCriteriaOR with a 'contains' condition.
    Error: [$parse:syntax] Syntax Error: Token ',' is unexpected, expecting [)] at column 18 of the expression [( (prompt63.value, 'contains', '1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,f65a6e70-2a54-9684-c263-0140e09d5adb,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f')) || (prompt62.value, 'contains', 'f65a6e70-2a54-9684-c263-0140e09d5adb,709f6ca6-a460-9003-39fd-047ce2dc1bcc,79daa23d-33e4-48b0-d88b-06ad0771d2ad,d1db0588-f159-fc9d-8866-09a8ce9e0ab7,1a8a20d5-01c4-a32d-c440-0b25bcbd0cc3,76f71819-d62b-4b0b-7450-0e371f4ca61a,d09067d6-a825-9220-4da0-20429359e6ef,b9b8f22d-9eb6-0055-1581-478fbe0009f1,738a5b24-c2db-d679-2df5-4ec6ff8b5bb9,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f,1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,7b09cd0e-70db-7883-8422-70ff1029e0c0,c2ae0925-8c42-5fb8-82af-78dddc28084b,1c0e38ce-ce13-96a1-a9b3-7bb2fcebb22c,1f2ade37-307c-02ec-fc10-9702fa7bcc65,d6962cb8-d0c9-dcf7-9fe2-9bb4306209cd,d592e1bc-da24-f87a-1837-9ce22cb6b20c,2d574ee8-f9d7-2438-62ad-9cf690317c24,3bbbb69b-5f24-a786-f70a-a26cd4677412,63eb69e7-b070-fe73-0bff-b37451826d43,c7884a4b-7f4a-eb57-3203-b3a8415828e5,9b6231f6-c6cf-7ef7-0811-b7b58c26737d,217869da-7fb2-f9db-ef42-c55ec7cc2aa4,5ca4d3b2-f9a9-f4f9-e828-cccc1c4fcbe4,ac394dbd-8adb-baf6-9b23-d21e63769b4c,3570f2da-f98f-8552-9984-57640d172ca3')) )] starting at [, 'contains', '1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,f65a6e70-2a54-9684-c263-0140e09d5adb,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f')) || (prompt62.value, 'contains', 'f65a6e70-2a54-9684-c263-0140e09d5adb,709f6ca6-a460-9003-39fd-047ce2dc1bcc,79daa23d-33e4-48b0-d88b-06ad0771d2ad,d1db0588-f159-fc9d-8866-09a8ce9e0ab7,1a8a20d5-01c4-a32d-c440-0b25bcbd0cc3,76f71819-d62b-4b0b-7450-0e371f4ca61a,d09067d6-a825-9220-4da0-20429359e6ef,b9b8f22d-9eb6-0055-1581-478fbe0009f1,738a5b24-c2db-d679-2df5-4ec6ff8b5bb9,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f,1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,7b09cd0e-70db-7883-8422-70ff1029e0c0,c2ae0925-8c42-5fb8-82af-78dddc28084b,1c0e38ce-ce13-96a1-a9b3-7bb2fcebb22c,1f2ade37-307c-02ec-fc10-9702fa7bcc65,d6962cb8-d0c9-dcf7-9fe2-9bb4306209cd,d592e1bc-da24-f87a-1837-9ce22cb6b20c,2d574ee8-f9d7-2438-62ad-9cf690317c24,3bbbb69b-5f24-a786-f70a-a26cd4677412,63eb69e7-b070-fe73-0bff-b37451826d43,c7884a4b-7f4a-eb57-3203-b3a8415828e5,9b6231f6-c6cf-7ef7-0811-b7b58c26737d,217869da-7fb2-f9db-ef42-c55ec7cc2aa4,5ca4d3b2-f9a9-f4f9-e828-cccc1c4fcbe4,ac394dbd-8adb-baf6-9b23-d21e63769b4c,3570f2da-f98f-8552-9984-57640d172ca3')) )].

    The error says a parenthesis is missing and it is missing '('. However, I don't think the criteria would work even if the parenthesis wasn't missing. 

    From the error above, this is the div element. 
    <div class="row question-container ng-hide ng-scope" ng-show="( (prompt63.value, 'contains', '1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,f65a6e70-2a54-9684-c263-0140e09d5adb,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f')) || (prompt62.value, 'contains', 'f65a6e70-2a54-9684-c263-0140e09d5adb,709f6ca6-a460-9003-39fd-047ce2dc1bcc,79daa23d-33e4-48b0-d88b-06ad0771d2ad,d1db0588-f159-fc9d-8866-09a8ce9e0ab7,1a8a20d5-01c4-a32d-c440-0b25bcbd0cc3,76f71819-d62b-4b0b-7450-0e371f4ca61a,d09067d6-a825-9220-4da0-20429359e6ef,b9b8f22d-9eb6-0055-1581-478fbe0009f1,738a5b24-c2db-d679-2df5-4ec6ff8b5bb9,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f,1622f5bd-f50b-0a91-9a34-58dcdbdcb79d,7b09cd0e-70db-7883-8422-70ff1029e0c0,c2ae0925-8c42-5fb8-82af-78dddc28084b,1c0e38ce-ce13-96a1-a9b3-7bb2fcebb22c,1f2ade37-307c-02ec-fc10-9702fa7bcc65,d6962cb8-d0c9-dcf7-9fe2-9bb4306209cd,d592e1bc-da24-f87a-1837-9ce22cb6b20c,2d574ee8-f9d7-2438-62ad-9cf690317c24,3bbbb69b-5f24-a786-f70a-a26cd4677412,63eb69e7-b070-fe73-0bff-b37451826d43,c7884a4b-7f4a-eb57-3203-b3a8415828e5,9b6231f6-c6cf-7ef7-0811-b7b58c26737d,217869da-7fb2-f9db-ef42-c55ec7cc2aa4,5ca4d3b2-f9a9-f4f9-e828-cccc1c4fcbe4,ac394dbd-8adb-baf6-9b23-d21e63769b4c,3570f2da-f98f-8552-9984-57640d172ca3')) )" onhide="" ro_toolbox_showhidedone="Updatedpass1">

    A working single 'contains' criteria is shown below. It calls compareQueryResult(). 
    <div class="row question-container" ng-show="((prompt62.value!=null)&amp;&amp;(compareQueryResult(prompt62.value, 'contains', 'f65a6e70-2a54-9684-c263-0140e09d5adb,709f6ca6-a460-9003-39fd-047ce2dc1bcc,d1db0588-f159-fc9d-8866-09a8ce9e0ab7,76f71819-d62b-4b0b-7450-0e371f4ca61a,738a5b24-c2db-d679-2df5-4ec6ff8b5bb9,6d7ec66a-cc7f-31c4-0abe-4eea8c93aa2f'')))" onhide="">

    So 'compareQueryResult' is missing from conditions with a 'contains'. I am no JavaScript expert and would appreciate it very much if RO Toolbox can handle 'contains' conditions. Thanks!
  • Steve_XiongSteve_Xiong Customer IT Monkey ✭
    I believe I fixed my problem in-regards to 'contains' conditions. The various ShowHideCriteria, AutoComplete, and MultiSelect were all broken for me when using a "contains" condition in layouts.  

    I added code to not call modBoolCriteria if 'contains' is found in the criteria. There should be eight calls to modBoolCriteria. See the picture below for fixing ShowHideCriteria.



    A word of caution, I don't know if introduced some other problems. Please test. Thanks.
  • Jeff_LangJeff_Lang Customer Advanced IT Monkey ✭✭✭
    fixing it that way should cause no issues at all, and was almost exactly what i'll be adding to it once i'm back at work Monday. not sure exactly when i'll upload it to github though as i also have to try to get it to work with a new control that is coming on AROs' as well

  • Robin_WaarsenburgRobin_Waarsenburg Customer IT Monkey ✭
    We'd like to see something resolved before going live in our production environment. 
    Autocomplete is working fine, but when you select a user and then clear the field (i.e. because you accidentally selected the wrong user), the first selected user is being remembered. Now if you start typing a different username but this time you forget to select a user from the suggestions, the first (removed) selection will be saved once the form is submitted. 

    So, if you'd like to reproduce this issue, use autocomplete, select an item, clear the field and type something different without selecting anything this time. Form can be saved even if this field is required because a valid selection was made (the first one which was removed). 
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    Yeah, that's been an issue since the beginning. Work-around is to use @MultiSelect on a query prompt, without configuring it to allow multiple selections.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭

    Seems like @AutoComplete / @MultiSelect tags are breaking the RO commit in v9.3.10. Can anyone confirm this?

    It seems to be tied to the newly(?) introduced roService.js which cannot process the answers, when using the tags.

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    edited August 23

    After a bit more digging, it seems like there multiple issues. First of all, there seems to be a bug i v9.3.10, where String prompts, not mapped to a WI property (ie used as a Token in query prompt), is not handled correctly, which cause

    Furthermore, there's now a new way that the portal handles query prompts with a new input element, where it stores a JSON representation of the selected items (instead of reading only the selected item ids), so it seems to be necessary to (in both createAutoComplete and createMultiSelect functions):

    Add Id and ClassTypeId to what preprocess returns, ie:

    return {
       "DisplayName": append,
       "BaseId": user.BaseId,
       "Id": user.Id,
       "ClassTypeId": user.ClassTypeId
    };
    

    Change from select to change in the kendoAutoComplete constructor.

    Replace everything in the change function of kendoAutoComplete and kendoMultiSelect constructors with the following (which is blatantly stolen from app.controls.js):

    var newData = [];
    
    if (multiselect === 'True') {
        this.dataItems().forEach(function (val, index, arr) {
            if (_.isUndefined(val.BaseId)) {
                val.BaseId = !_.isUndefined(val.Id) ? val.Id : null;
            }
            newData.push(val);
        });
    
    } else {
        var dataItem = this.dataItem();
    
        if (_.isUndefined(dataItem.BaseId)) {
            dataItem.BaseId = !_.isUndefined(dataItem.Id) ? dataItem.Id : null;
        }
    
        newData.pop();
        newData.push(dataItem);
    }
    
    var selectedItems = newData;
    var selectedItemIds = _.pluck(selectedItems, "BaseId");
    $("input[id='" + targetId + "']").each(function (i, el) {
        $(el).val(selectedItemIds.join(','));
        $(el).change();
    });
    
    var newDataJSON = [];
    newDataJSON = selectedItems;
    $('#Json' + targetId).val(JSON.stringify(newDataJSON));
    


    And lastly, to fix the bug in roService.js, you can add if(source.Targets == null) continue; right after var source = sources[i]; in the processNoneMapping function (note: Editing files outside of CustomSpace is completely unsupported by Cireson).

    Or wait for Cireson to release an official hotfix (issue is reported).

Sign In or Register to comment.