Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .
2021-07-16 09:43 AM
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.
2021-07-16 03:23 PM
@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
2021-07-16 10:17 PM
@DavidPetty Yes I am doing that using a custom, but if could use existing add new button it would be more intuitive.
2021-07-20 08:59 AM
@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