Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2021-08-17 12:10 PM
Hi all,
I have the following requirement:
I'm weak on the javascript side but understand I need some javascript in a custom object on my layout.
I have read many different threads on the custom object page but have found no answer.
Thanks for your help.
Referencing a very similar question which I could not get a result from: https://community.rsa.com/t5/archer-custom-objects/create-popup-message-upon-save/m-p/467369
2021-08-17 02:33 PM - edited 2021-08-17 02:36 PM
<script>
var
title = 'Confirmation is required',
message = 'Please confirm';
function saveApply(action) {
var userConfirmed = function(arg){
if(arg) {
if(action == 'save') {
$('#master_btnSave').click();
} else if(action == 'apply') {
$('#master_btnApply').click();
}
}
};
WarningConfirm(message, userConfirmed, title);
}
Sys.Application.add_load(function() {
$('#master_btnSave1').unbind('click').prop("onclick", null).click(function(){ saveApply('save'); return false;});
$('#master_btnApply1').unbind('click').prop("onclick", null).click(function(){ saveApply('apply'); return false;});
});
</script>
2021-08-17 12:35 PM - edited 2021-08-17 12:36 PM
I think something similar was asked in here:
https://community.rsa.com/t5/archer-custom-objects/custom-object-archer-functions/m-p/516323#M1521
Basically you need WarningConfirm function.
2021-08-17 01:35 PM - edited 2021-08-17 02:27 PM
Hi IIya,
I have read through those articles and cannot seem to piece together the required code
@DavidPetty Do you know of simple code to achieve this
2021-08-17 02:33 PM - edited 2021-08-17 02:36 PM
<script>
var
title = 'Confirmation is required',
message = 'Please confirm';
function saveApply(action) {
var userConfirmed = function(arg){
if(arg) {
if(action == 'save') {
$('#master_btnSave').click();
} else if(action == 'apply') {
$('#master_btnApply').click();
}
}
};
WarningConfirm(message, userConfirmed, title);
}
Sys.Application.add_load(function() {
$('#master_btnSave1').unbind('click').prop("onclick", null).click(function(){ saveApply('save'); return false;});
$('#master_btnApply1').unbind('click').prop("onclick", null).click(function(){ saveApply('apply'); return false;});
});
</script>
2021-08-18 05:15 AM
@Ilya_Khen fantastic, I have tested this and it works a charm!
As always, I appreciate the effort you put into this!
2021-08-18 05:16 AM
Anytime
2021-08-18 05:40 AM
Small amendment and question.
Using your code from another forum to hide the save & save and close buttons, I now would like to update the above code so that the pop-up appears when the user clicks on the AWF button that starts the workflow:
I used inspect element to get the name of the AWF button and added it to the code: see below. When I select "Submit for GIS REview" the message appears, when I select "Ok" in the pop-up, nothing happens. I assume I am missing a function to start the workflow but I cannot figure it out. Appreciate your support.
<script>
var title = 'Confirmation is required',
message = 'Select OK if you would like to proceed with submission, changes canot be made once engagement is submitted';
function saveApply(action) {
var userConfirmed = function(arg) {
if (arg) {
if (action == 'save') {
$('#master_ondemand_16').click();
} else if (action == 'apply') {
$('#master_ondemand_16').click();
}
}
};
WarningConfirm(message, userConfirmed, title);
}
Sys.Application.add_load(function() {
$('#master_ondemand_16').unbind('click').prop("onclick", null).click(function() {
saveApply('save');
return false;
});
$('#master_ondemand_16').unbind('click').prop("onclick", null).click(function() {
saveApply('apply');
return false;
});
}); </script>
2021-08-18 06:14 AM
You are changing behavior of your AWF button everywhere, surely you will have no actions happened after click. You removed the click functionality and then referring to it back in the saveApply function.
2021-08-18 06:49 AM
Hmm ok, So is it possible for a pop-up message to appear when the AWF "Submit" button is selected? I thought changing the button name in your code might do it but it doesn't seem to
2021-10-14 11:55 AM
Hi IIya,
Is there an updated version of this to work with AWF?
Thank you so much!