Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

How to override add new functionality of cross reference field on UI

grv.mishra
Collaborator III

I have a requirement to fetch data from an api and create record on the click of add new button on the cross refence field on UI. How can I override its default functionality inside custom object.

 

 

grvmishra_0-1626443028464.png

 

3 REPLIES 3

DavidPetty
Archer Employee
Archer Employee

@grv.mishra, you don't have to hijack the Add New link per say.  You could roll your own button that makes the API call to get the data then make a call to Archer's REST API to create the record, get the returned content/tracking id and update the cross-reference field in the parent record with said id using this function, Re: custom object for cross reference field - RSA Link - 483261

 Advisory Consultant

@DavidPetty Yes I am doing that using a custom, but if could use existing add new button it would be more intuitive.

@grv.mishra, you'd have to get the element and clear its click events.

Something like below:

const control = $find($CM.getFieldById(1234).clientId); // <- Replace 1234 with the cross-reference field in
const namingContainer = control._namingContainer;
$('#'+namingContainer).find('.add-new')[0].unblind('click').prop('onclick',null) //<- add your click event here.

 

 Advisory Consultant