Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Button in Menu Header

AshaHB
Contributor III

Hi, I have a requirement wherein to place a custom button(Submit Certification) in the header.

pastedImage_1.png

 

Adding the code which I have used to create the Custom button:

 

<div class="toolbar-app-buttons-left">
<a title="Set Value" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" data-check-dirty="false">
<div class="tb-btn" data-icon="&#xE348" data-icon-pos="left">Submit Certification</div>

</a>

</div>

<script type="text/javascript">
var integration = {
statusFieldId:"field ID",
statusSubmit:"Value ID"
};
$('#btnSetValue').click(function(){
UpdatesValueList(integration.statusFieldId, integration.statusSubmit);
$('#master_btnSave').click();
});

function UpdatesValueList(changeId, assignedValue) {
var valueArray = new Array(1);
valueArray[0] = assignedValue;
$CM.setFieldValue(changeId, valueArray, '');
$('#master_btnSave').click();
}
</script>

 

It all works fine I just now need to add this button header menu. 

ASHA
10 REPLIES 10

AshaHB
Contributor III

Hi David,

pastedImage_1.png

when they click submit it updates Status field as complete and Save the record
But now we have to add another condition to this
which is VL, type radio button .Only when we select a Value from that field we should update.
I have tried adding the if condition before the Function call
<script type="text/javascript">
if($('#btnSetValue').length == 0) $('<a title="Submit Certification" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" data-check-dirty="false"><div class="tb-btn" data-icon="&#xE348" data-icon-pos="left">Submit Certification</div></a>').insertAfter('#master_btnSave');
var integration = {
statusFieldId:"FieldID",
statusSubmit:"ValueID"
};

 

$('#btnSetValue').click(function(){
UpdatesValueList(integration.statusFieldId, integration.statusSubmit);
$('#master_btnSave').click();
});
If(Fieldid==ValueID1||ValueID2){
function UpdatesValueList(changeId, assignedValue) {
var valueArray = new Array(1);
valueArray[0] = assignedValue;
$CM.setFieldValue(changeId, valueArray, '');
$('#master_btnSave').click();
}
}
</script>
Not sure how to achieve this
ASHA