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

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Object - Close Button

syedtahir16
Advocate

I'm trying to create a custom object to close the record

 

<a class="tb-btn-link-left" id="CloseRecord" onclick="javascript:__doPostBack('', 'recordClose');" data-check-dirty="true"><div class="tb-btn" data-icon="&#xe366;" data-icon-pos="left">Close</div></a> 

 

Issue:

Click on Add new record: key in a few of the fields then click on Close record. The record closes fine. Now when I navigate to another workspace, it shows a popup warning that I have unsaved changes.

 

Same happens when i make a change to an existing record.

24 REPLIES 24

Ilya_Khen
Champion III

Try:

javascript:CloseRecord('recordClose')‍‍

 

Or:

$('#master_btnView').click();

Thank you Ilya.

 

javascript:CloseRecord('recordClose')

The above has the same issue as mentioned in OP:

 

Click on Add new record: key in a few of the fields then click on Close record. The record closes fine. Now when I navigate to another workspace, it shows a popup warning that I have unsaved changes.

Interesting, when you add some fields, and close record, you immediately should see warning.

Well, try 2nd approach.

Also the below does not work on when adding a new record

$('#master_btnView').click();

Arun.Prasad
Advocate II

Hello Syed,

 

That is a feature introduced in Archer version 6.x to avoid people from losing their content when they accidentally click anywhere outside the record. AFAIK, there is a dirty-check attribute associated with every element within the Archer form, which will be set after any changes to a field within the form and when you try to navigate out of the Archer record without clicking on "Save" or "Save & Close" , it will traverse through the form and validate the attribute of each element and prompt you that there are unsaved changes if the changes are not saved. The same works for the close (X) button too. It should have prompted immediately as well. Maybe the check is delayed a bit and that's the reason you are seeing the prompt when you click anything after the below.

 

Click on Add new record: key in a few of the fields then click on Close record. The record closes fine. Now when I navigate to another workspace, it shows a popup warning that I have unsaved changes.

Yes, thats what I thought too. I mean the original close works perfectly fine. Its just that on the custom object it does not

Ilya_Khen
Champion III

Well, then just simulate standard button:

<script>
function closeRecord() {
var mEvent = document.createEvent("MouseEvents");

mEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

var closeBtn = document.getElementsByClassName("frame-icon-close")[0];

closeBtn.dispatchEvent(mEvent);
}
</script>

<input type="button" name="Close_Record" value="Close" onclick="javascript:closeRecord();">

Thank you, Ilya. This works. But it does not work if I have a new record -> Do not fill out any values in the form. Click on it. I remains on the same screen. 

Works fine for me in either case. Closes normally without warning when I do not enter anything. So, something environment specific to you then.