Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2024-01-02 03:45 PM
I have 2 different fields, one from a xRef, and other from the questionnaire, when I click the save button the expected is to check if the questionnaire field is greater than the xRef field, is it possible using custom object? I'm trying to use custom object, 'cause the field I'm looking is calculated based on the questionnaire status, so if I try to get it using a calculted field I'm receiving circular formula error.
2024-01-03 09:05 AM
A custom object won't trigger as "receiving circular formula" error itself. Sounds like a calculation in the app is throwing that error when saving.
To hijack the Save and Save and Close buttons you can use this.
// Clone Save Button
$('#master_btnApply1').clone().attr('id', 'btnCustomSave').css({"margin-right" :"12px"}).insertAfter('#master_btnApply1');
$('#master_btnApply1').attr('id','master_btnApply1ORG').hide();
$('#btnCustomSave').attr('id','master_btnApply1').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('apply');
});
// Clone Save And Close Button
$('#master_btnSave1').clone().attr('id', 'btnCustomSaveAndClose').insertAfter('#master_btnSave1');
$('#master_btnSave1').attr('id','master_btnSave1ORG').hide();
$('#btnCustomSaveAndClose').attr('id','master_btnSave1').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('save');
});
// Clone Apply (disk icon) Button
$('#master_btnApplyIcon').clone().attr('id', 'btnCustomApply').css({"margin-right" :"12px"}).insertAfter('#master_btnApplyIcon');
$('#master_btnApplyIcon').attr('id','master_btnApplyIconORG').hide();
$('#btnCustomApply').attr('id','master_btnApplyIcon').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('apply');
});
// Remove Save and Save and Continue Right-Click Menu
$('.rmText:contains("Save and Close")').parent().parent().hide();
$('.rmText:contains("Save")').parent().parent().hide();
Replace myFunction with your function passing either 'apply' or 'save' parameter.
Then in your function(action) you'll need to add the following to trigger the actual save or apply.
if (action == 'save') {
$("#master_btnSave1ORG").click();
} else if (action == 'apply') {
$("#master_btnApply1ORG").click();
}
Advisory Consultant
2024-01-02 04:25 PM
@toberle calculations are done on the backend so it does require the record to be saved first.
What formula are you using in the calculation?
Advisory Consultant
2024-01-02 04:34 PM
I want to use the save button as my trigger... on the other post, is the same formula
2024-01-03 09:05 AM
A custom object won't trigger as "receiving circular formula" error itself. Sounds like a calculation in the app is throwing that error when saving.
To hijack the Save and Save and Close buttons you can use this.
// Clone Save Button
$('#master_btnApply1').clone().attr('id', 'btnCustomSave').css({"margin-right" :"12px"}).insertAfter('#master_btnApply1');
$('#master_btnApply1').attr('id','master_btnApply1ORG').hide();
$('#btnCustomSave').attr('id','master_btnApply1').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('apply');
});
// Clone Save And Close Button
$('#master_btnSave1').clone().attr('id', 'btnCustomSaveAndClose').insertAfter('#master_btnSave1');
$('#master_btnSave1').attr('id','master_btnSave1ORG').hide();
$('#btnCustomSaveAndClose').attr('id','master_btnSave1').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('save');
});
// Clone Apply (disk icon) Button
$('#master_btnApplyIcon').clone().attr('id', 'btnCustomApply').css({"margin-right" :"12px"}).insertAfter('#master_btnApplyIcon');
$('#master_btnApplyIcon').attr('id','master_btnApplyIconORG').hide();
$('#btnCustomApply').attr('id','master_btnApplyIcon').unbind('click').prop("onclick", null).click(function(e){
e.stopImmediatePropagation();
e.preventDefault();
myFunction('apply');
});
// Remove Save and Save and Continue Right-Click Menu
$('.rmText:contains("Save and Close")').parent().parent().hide();
$('.rmText:contains("Save")').parent().parent().hide();
Replace myFunction with your function passing either 'apply' or 'save' parameter.
Then in your function(action) you'll need to add the following to trigger the actual save or apply.
if (action == 'save') {
$("#master_btnSave1ORG").click();
} else if (action == 'apply') {
$("#master_btnApply1ORG").click();
}
Advisory Consultant