Hi ,
Can we sort multi select on entry screen,i.e when multi select appear on screen it appear in sort order of its name rather than caption code.
Thanks
Adnan
Hi ,
Can we sort multi select on entry screen,i.e when multi select appear on screen it appear in sort order of its name rather than caption code.
Thanks
Adnan
1. Log in to the CRM as Administrator User.
2. Navigate to the Administration -> Customization -> Companyà Fields
3. Select the Product Categories field and click on the pencil icon.
4. The new window ‘Maintain Lookup Selections for Product Categories’ will get open.
5. On this screen you can see all the available values for this field.
6. Order the fields as required. You can order the values accordingly by using the green arrows.
7. Once you are done with the required ordering click on the save button.
Thanks for the response... i have around 500 values in that multi-select and they are all up and down. it will be quite difficult to manually sort them. and as you keep on adding , it will again go in wrong order.. i believe writing some java-script is the solution... if someone can provide some sort of default script.. that would be great
1. Goto AdministrationàCustomizationà.
2. Open the screen where the required field is located.
3. Paste the below JQuery in the Custom Content of your screen.
4. After pasting the code in the custom content, click on the Save button.
Hi Dinesh
I have tried to use your code and I am not very familiar with jQuery but it does not seem to work for me.
Have you actually run this code? I ask because I had to remove the "src" statement to make it run at all (I replaced the sortDropDownListByText call with an alert) and when I put the call back it does not sort my "comp_sector" (Segment) field.
Thanks
1. Open IE and go to http://code.jquery.com/jquery-latest.js.
2. You will be asked to download the file. Download it.
3. Create a new folder jQuery under WWWRoot folder which is available at the below location.
“C:\Program Files\Sage\CRM\”<>”\WWWRoot\”.
4. Copy and paste the downloaded file in the jQuery folder.
Hi,
If you want to sort all the the select or multi select on a screen, you can use this function :
function sortDropDownListByText() {
// Loop for each select element on the page.
$("select").each(function() {
// Keep track of the selected option.
var selectedValue = $(this).val();
// Sort all the options by text. I could easily sort these by val.
$(this).html($("option", $(this)).sort(function(a, b) {
return a.text.toUpperCase() == b.text.toUpperCase() ? 0 : a.text.toUpperCase()
}));
// Select one option.
$(this).val(selectedValue);
});
}
Hi, im trying to set this up for a multi select field but the code doesnt seem to be working, has anyone been able to get this working so that large multi selection lists are alphabetically sorted when editing a record and when viewing a record?
hi Sufyan
In custom content with script tags, try:
$(function(){
$("#selectFieldId").html($("#selectFieldId option").sort(function(opt1,opt2){
return $(opt1).text() < $(opt2).text() && $(opt1).val() ? -1 : 1;
}));
});
replacing selectFieldId with the id of the relevant select field.
paul
I must admit I've not see the problem, with my multi-selects I manually adjust the order of the items in the selection field to be the order I want them to be in (normally alphabetically) and this then displays in that order when edited the record and the values when selected all appear in alphabetical order.
Two Multi-selects with their values in alpha order (except the bottom one which has 'Other' as the last option)
When saved the results show in the same order as they appeared in the list
thanks Paul - that works a treat!
the issue was that a particular multi select list had around 100 options in it and when adding new ones you have to manually move the new option to the correct place which takes ages - Paul's code works a treat though
I've had that with one of our lists as well, I did a SQL update to reorder the capt_order based on the alphabetical order of the values within
*Community Hub is the new name for Sage City