Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to use the save/save and close button to validate a field?

toberle
Contributor II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

DavidPetty
Archer Employee
Archer Employee

@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

I want to use the save button as my trigger... on the other post, is the same formula

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