I have added a select field to form and i want to add data in it.
I added the code on form validate but its not reflecting on form.
def validate(self):
# Call an API
url = "https://api.compattern.com/api/AssignedResource/Problems"
response = requests.get(url)
response.raise_for_status() # check for errors
# Load JSON data into a Python variable.
jsonData = json.loads(response.text)
array = []
#pprint(jsonData)
for i in jsonData['data']:
array.append(i.get('workOrderNumber'))
self.custom_work_order_number = array
custom_work_order_number is the form field name.
I created the method to see array is getting data or not from external API and its working and returning data in array.
@frappe.whitelist()
def GetProblems():
# Call an API
url = "https://api.compattern.com/api/AssignedResource/Problems"
response = requests.get(url)
response.raise_for_status() # check for errors
# Load JSON data into a Python variable.
jsonData = json.loads(response.text)
array = []
#pprint(jsonData)
for i in jsonData['data']:
array.append(i.get('workOrderNumber'))
return array
Please guide me about this
Thanks