After months of trying to resolve this issue by myself, I have finally decided to deal with my anxiety and just ask for help…
We have recently adopted ERPNext for internal testing but I am having issues with creating a custom field which fetches a value from a Subscription doctype.
Essentially what I am trying to achieve is to create a custom field in Subscriptions called “Subscription Reference” which will be populated with a value. Then I created a custom field on Sales Invoices named “Invoice Reference”, and I would like this “invoice reference” field to be populated by the “Subscription Reference” value, but only if the invoice was auto generated from a Subscription. If the invoice is not generated by a Subscription, we will manually type in the values on “Invoice Reference” field.
Any advise on how I can go about achieving this?
Hi there Smit,
Thank you very much for the response,
Yes, I created a custom field in “Subscriptions” with a Fieldname of invoice_referance and the field type as “Data”.
Then created another in “Sales Invoices” also named invoice_referance (Nevermind the spelling error ) and gave it a “Fetch From” value of “Subscription.invoice_referance”.
And I’ve had no luck with this thus far . It’s basically not fetching the value from what I can see.
Fetch from divided in two parts
- First part is the link field in existing doctype.
- second is the field from the linked doctype.
You should be using field names.
So something like
auto_repeat.invoice_reference should work.
auto_repeat is a link field in the sales invoice that references the subscription (verify).
invoice_reference is the field from auto_repeat that you would like to fetch.
@Smit_Vora , Thank you very much,
I think that I understand what you are explaining here !!! I am just going to try and I will report back shortly
Okay, so I’ve had semi success thus far.
What I’ve noticed is that there doesn’t seem to be a field in Sales Invoices which is actually linked to “Subscriptions”. So what I have done is created a custom link field called “subscription ID” in “Sales Invoices”, this custom field is linked to “Subscriptions”. Then I changed my “Invoice Reference” custom field to fetch from subscription_id.invoice_reference.
It works, but only once I manually select my Subscription name in the custom “subscription ID” link field.
My question now, is how do I get my custom “subscription ID” field to automatically fetch the “Subscription Name” from the subscription which auto created the “Sales Invoice” without having to manually select the “Subscription Name”?
Any advise on this matter will be welcome?