Need help with fixtures

Hi Guys ,

Greetings for the day . I have few custom scripts running for my custom apps , I am planning to integrate inside my app , at present these scripts are in custom script interface in erp I mean in db . I tried creating a folder under

my_app/fixtures/custom_script, and in this folder added my custom scripts like:

myscript.js

But this is not working . Could someone guide me with this ?

Thanks in advance

@ragav Have a look at:

https://frappe.github.io/frappe/user/en/guides/app-development/how-to-create-custom-fields-during-app-installation

You need to add “Custom Script” to fixtures

1 Like

In hooks.py file

Add
fixtures = [“Custom Script”]

1 Like

Many thanks for the reply @JoEz and @Hafees_Kazhunkil .

I put my custom script in

/home/ommi/frappe-bench/apps/product_master/product_master/fixtures/prod_master.js

and included this in hooks.py file

# app_include_js = "/home/ommi/frappe-bench/apps/product_master/product_master/fixtures/prod_master.js"

but still my scripts does not work , please guide me .

Thanks in advance

I suggest again to read and pay attention on:

https://frappe.github.io/frappe/user/en/guides/app-development/how-to-create-custom-fields-during-app-installation

You need only to add

fixture = ["Custom Script"]

in hooks.py of your app

1 Like

Thanks a bunch for the help @JoEz , I added fixture = ["Custom Script"] and ran bench export fixtures command , a folder got created inside my app , that is fixtures and where I was able to find a json file , after this I started the bench , but the script works only if I have my scripts in custom script location , I thought the scripts for the app will work with the json file that got created automatically . Will this script get installed automatically when I install this app in a new site ?

Please advise
Thanks .

Yes, it will get installed when u install urtis custom app to a new site

1 Like

Thanks a lot @JoEz .