
my code is supposed to take info from the context and open a new form to populate it
i tried with xrm.page and formContext but didnt work
heres my code i dont know why its not working and in the debugger it says there's something wrong with populating the optionset
function CreateAndPopulateNewBackupDetailsForm(Context)
{
var formContext = Context;
var name = formContext.getAttribute("firstname").getValue();
var addressName = formContext.getAttribute("address1_name").getValue();
var mobilephone = formContext.getAttribute("mobilephone").getValue();
var email = formContext.getAttribute("emailaddress1").getValue();
var faxNumber = formContext.getAttribute("fax").getValue();
var entity = {};
entity.alf_name = name;
entity.alf_address = addressName;
entity.alf_email = email;
entity.alf_telephone = mobilephone;
entity.alf_fax = faxNumber;
entity.getControl("alf_contact").getAttribute().getValue();
Xrm.WebApi.online.createRecord("alf_backupdetails", entity).then(
function success(result) {
var newEntityId = result.id;
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
Hi,
Is the formContext obtained correctly?
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Frank Gong