Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2022-04-08 03:26 AM
I have a custom object that creates a subform record using content controller, now I need to attach this subform record to cross reference field. I dont want to do put call on content controller. How to achieve this using javascript.
2022-04-08 03:37 PM
Use the newly created content ID of that subform, and call the Archer Rest API to update the record you want to attach this subform record to, I believe you have to call UPDATE on the parent record.
2022-04-26 11:05 AM
This code creates from app 1, an app 3 record and adds it to the right xref field on app 2 (app 2 record is xref'd to app 1)... you can probably use some of it to do what you are looking to do:
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Add Record" class="tb-btn-link-left" id="btn_AddRecord" href="javascript:void(0);">
<div class="tb-btn " data-icon="" data-icon-pos="left">Add Record</div>
</a>
</div>
<script type="text/javascript">
var parentApplicationId = 598; // application 'b'
var destinationApplicationId = 601; // application 'c'
var destinationApplicationLevelId = 334; // application 'c'
var parentCrossReferenceFieldId = 37220; // application 'a' cross-reference field on application 'b'
var CrossReferenceFieldId = 37032; // application 'b' cross-reference field on application 'a'
var crossReferenceContentId;
var temp;
Sys.Application.add_load(function() {
var crossReferenceContentId = JSON.parse($('input[name$="SelectedValues'+ CrossReferenceFieldId +'"]').val());
temp = String(crossReferenceContentId);
//debugger;
//console.log(crossReferenceContentId);
});
$('#btn_AddRecord').click(function (){
if (!crossReferenceContentId) {
$pb('{"a":[{"Key":"contentid","Value":"' + temp + '"},{"Key":"fieldid","Value":"' + parentCrossReferenceFieldId +'"},{"Key":"moduleId","Value":"'+ parentApplicationId+ '"},{"Key":"refmodid","Value":"' + destinationApplicationId + '"},{"Key":"levelid","Value":"' + destinationApplicationLevelId + '"},{"Key":"isSubform","Value":"False"},{"Key":"isAnswerValuesSubform","Value":"False"}],"e":"refFieldAddNew"}');
csp(event);
return false;
}
});
</script>