I have customized my User doctype to have additional property (doc-field) and all my users now have this new property.
Now, what I want to accomplish is, when a user creates a particular doctype (Lets say ‘doctype:XZY’), I want that doctype XYZ to have a default read-only property field that fetches data from the User’s new created docfield property and set its value.
My question is how do I fetch this particular property’s value from the current user’s property/docfield’s list?
So I tried your option and entered this using client script option,
> frappe.ui.form.on('Insured Employee', {
> refresh(frm) {
> // your code here
> frm.add_fetch('user','insuringcompany','company_covered')
>
> }
> })
To make my code clear, insuringcompany is the docfield that is in the User doctype, and I want to the fetch the insuringcompany doc-field and input it in the Insured Employee’s doctype > company_covered (docfield).
However, I wasnt able to get the value from the desired docfield using this. Am I doing something wrong?
Beginner in frappe here
Also please make note that I want to fetch the current User’s docfield data.
Thanks in advance
Insured Employee doesnt have a user field so I tried the latter option; however, company_covered is still not showing in the Insuring Company field, insuringcompany. Instead, the insuringcompany field just has the text ‘Insured Company’ in the UI.