Pass 2 distinct values to new /edit form
Posted: 19 Feb 2018
Hello, I am just learning Javascript and have been relying heavily on copy/paste as I figure things out (so bear with me)
I have a situation where I need to pass 2 values from a related list to the Edit/ new functions.
I am able to pass the ID (to create new values and link the related items) but I am struggling to pass the second Value (association).
on the parent form I have this: (the ContractorEquipment id is the ID, and Assocation is the second value)
fd.populateFieldsInGrid($('.related-assoc'), {
Association: '{CurrentItem}',
});
fd.populateFieldsInGrid($('.related-items'), {
ContractorEquipmentID: '{CurrentItem}',
in the receiving form I have this (New)- this populates the value then hide/shows specific fields based on the association.
if (window != window.top && window.top.fd) {
// the form is opened in a dialog from the parent form
var parentId = window.top.GetUrlKeyValue('ID');
var AssocId = window.top.GetUrlKeyValue('Association_x0020_Name');
if (parentId) {
// the form is opened from the Edit form
fd.field('ContractorEquipmentID').value(parentId);
fd.field('Association').value(parentid);
} else {
// the form is opened from the New form
$('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
fd.field('Association').value(AssocId);
}
$('.related-equipment').hide();
}
function HideShow() {
if (fd.field('Association').value() == 'TOMA') {
// Setting the Percent Complete to 100
$('.ded-wmca').hide();
// Getting JQuery-object of the field container and hide it
} else {
// Getting JQuery-object of the field container and show it
$('.ded-toma').hide();
}
}
HideShow();
I have a situation where I need to pass 2 values from a related list to the Edit/ new functions.
I am able to pass the ID (to create new values and link the related items) but I am struggling to pass the second Value (association).
on the parent form I have this: (the ContractorEquipment id is the ID, and Assocation is the second value)
fd.populateFieldsInGrid($('.related-assoc'), {
Association: '{CurrentItem}',
});
fd.populateFieldsInGrid($('.related-items'), {
ContractorEquipmentID: '{CurrentItem}',
in the receiving form I have this (New)- this populates the value then hide/shows specific fields based on the association.
if (window != window.top && window.top.fd) {
// the form is opened in a dialog from the parent form
var parentId = window.top.GetUrlKeyValue('ID');
var AssocId = window.top.GetUrlKeyValue('Association_x0020_Name');
if (parentId) {
// the form is opened from the Edit form
fd.field('ContractorEquipmentID').value(parentId);
fd.field('Association').value(parentid);
} else {
// the form is opened from the New form
$('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
fd.field('Association').value(AssocId);
}
$('.related-equipment').hide();
}
function HideShow() {
if (fd.field('Association').value() == 'TOMA') {
// Setting the Percent Complete to 100
$('.ded-wmca').hide();
// Getting JQuery-object of the field container and hide it
} else {
// Getting JQuery-object of the field container and show it
$('.ded-toma').hide();
}
}
HideShow();