cancel
Showing results for 
Search instead for 
Did you mean: 

JS injection for field replacement

Former Member
0 Kudos

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!

Accepted Solutions (0)

Answers (2)

Answers (2)

marco_becker2
Explorer
0 Kudos

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

stephan_best
Advisor
Advisor
0 Kudos

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_plugine...

maybe that will help you

kind regards

Stephan