Skip to Content

JS injection for field replacement

Hello CCO experts,

We are trying to replace search fields in the Advanced Search with dropdown boxes via CCO Plugin. And it comes to a problems with Javascript - our injections doesn't give us any changes in objects.

I would like to ask, if you have faced similar cases and if you can provide working JS code (just a main statements). Or may be some suggestion, about coding approach.

Unfortunately, it comes to a troubles for a developers.

Thanks in advance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 18 at 07:44 AM

    Hi Ildar,

    in the partner edge we offer some coding examples:

    https://partneredge.sap.com/en/library/assets/products/cust_mng/scc/implement/tr_ug_scc20fp1_pluginexamples.html

    maybe that will help you

    kind regards

    Stephan

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 18 at 07:52 AM

    Hello Ildar,

    here is a small example, hot to replace the "lastName" search input field with a select element:

    $('#searchDialogBtn').on("click", () => {
    	var option = $('<select/>').attr("id", "searchInput_lastName").attr("name","searchInput_lastName").addClass("searchInput").addClass("customerSearchFields").addClass("text").append($("<option></option>")).append($("<option>Lastname1</option>")).append($("<option>Lastname2</option>"));
    	$('#searchInput_lastName').replaceWith(option);
    });
    

    It is important, that the new select element has the same id and name as the original input field. You can copy this code the the chrome developer console, when you are on the sales screen, to try it out. As soon as you open the search, with the search button at the top right, you will see the drop down list. Note: This will only work, if you configured the search dialog to show the "lastName" field. This can be done on the configuration page. There is a tab called "Dialog settings". You have to toggle the "Basic search" switch for the "lastName" field to "ON".

    Best regards

    Marco

    Add comment
    10|10000 characters needed characters exceeded