Page 1 of 1

Different results when retrieving data from parent-form

Posted: 05 Nov 2021
by UDRO
We are getting different results in a parent-form that is called by “New entry” of an related item. Depending on the user we get different results when retrieving data from the parent form.

This is the code we use to access the data of the parent-form. RegAbt is a normal lookup, BUTeams1 is a simple textfield, Fachgebiet is a Plumsails-Lookup

console.info("Start");
var parentId = parseInt(window.top.GetUrlKeyValue('ID'));
var parentBerID = (window.top.fd.field('Title').value());
var parentRLSB = (window.top.fd.field('RegAbt').value());
var parentRBT = (window.top.fd.field('BuTeams1').value());
var parentFachgebietID = (window.top.fd.field('Fachgebiet').value());
var parentFachgebiet = (window.top.fd.field('Fachgebiet').control('data')['Title']);
var parentFG = (window.top.fd.field('Fachgebiet').control('getSelectedText'));

console.info("ParentId");
console.log(parentId);
console.info("ParentBerID");
console.log(parentBerID);
console.info("ParentRLSB");
console.log(parentRLSB);
console.info("ParentRBT");
console.log(parentRBT);
console.info("ParentFachgebietID");
console.log(parentFachgebiet);
console.info("ParentFG");
console.log(parentFG);

console.info("gesetzt");

The results are different. User-A has Admin-rights, User-B not. But even when we provided more rights to user B the results did not change. However, all 3 "real" Admins get the same results.

Console User A (Admin, everything is fine except "RegAbt")
User-A.png
User-A.png (52.24 KiB) Viewed 5089 times
Console User B (no Admin, different error message, RegAbt is ok, but Buteams1 and Fachgebiet are undefined)
User-B2.png
User-B2.png (165.03 KiB) Viewed 5089 times


Thank you!

UDRO

Re: Different results when retrieving data from parent-form

Posted: 05 Nov 2021
by Nikita Kurguzov
Dear UDRO,
That's strange, but we'll need more info about fd.field('BuTeams1') and fd.field('Fachgebiet') - what types of fields are these? What is their value on the parent form? Can you post a screenshot? Can the users work with these fields normally, without the code?

Re: Different results when retrieving data from parent-form

Posted: 10 Nov 2021
by UDRO
Hi Nikita,

we have continued testing and we've come a little bit closer. User A and B are using different parent-forms.
In the parent form of User B most of the fields we want to use in the child-form are read-only.

We know that read-only-fields need special treatment wehen saving data. Perhaps this is related to our actual problem.

How can we solve this?

Thank you, UDRO

Re: Different results when retrieving data from parent-form

Posted: 10 Nov 2021
by Nikita Kurguzov
Dear UDRO,
Are the fields set as readonly in the editor via UI or via JavaScript?

Re: Different results when retrieving data from parent-form

Posted: 10 Nov 2021
by UDRO
Dear Nikita,

they are set by UI using Form Designer.

Cheers

Re: Different results when retrieving data from parent-form

Posted: 11 Nov 2021
by Nikita Kurguzov
Dear UDRO,
Then, these fields don't even have a value loaded - they are just text labels. You can get their text like this:

Code: Select all

var text = fd.field("FieldName").control()._el().text();