- My View
Good day all,
Can someone please explain to me why would GlideRecord.insert() be allowed, but the GlideRecord.insertWithReferences() is not allowed (even when the referenced object is in the same scope)?
Is there a workaround for this, i.e. if I have form A, and I need to push to Form B, which has a lot of Form C children
Form A could be seen "almost" as a console to the application.
Form C has a reference to Form B, thus I can list all the children Record C's directly from Form B.
Well that was the theory, designed a nice 3NF solution, but I cannot implement it now.
Snippet of my code (simplified to only 2 forms), this gets executed from form A:
var frmB = new GlideRecord('x_scope_form_b');
frmB.name = current.name //set's the name of Record B the same as that of Record A, working as expected
//frmB.frmA is a reference field to Form A
frmB.frmA = current; //This part doesn't work. When this is in there, the entire transaction fails, when I remove it, everything else works
You can use
frmB.frmA = current.sys_id;
then use frmB.insert();
This should work as a workaround
If I create the child record first, and use this method, this is working yes.
i.e. you cannot create the record directly as per the insertWithReferences wiki, but at least I can link them properly now.
it's not possible to use insertWithReferences function? I want to add it on my scope.