Custom Script on Workspace

Hi Frappe Community!

Is there any possibility to apply a Custom Client Script on a Workspace?

I know it can be applied to the Form view and the List view of the Workspace Doctype, but there is no possibility to apply it to the frontend, where the user views the workspace.

Also adding javascript into custom html blocks did not do the trick for me.

Would be really nice to have this possibility for customization.

Hi @pronext :

AFAIK there is no way to achieve this with client script.

Create a custom app instead.

You will need to edit hooks.py file . It is located under your app folder (yourbench/apps/yourapp/hooks.py). Add a line like this:

app_include_js = "/assets/app_name/js/yourapp.js"

Create yourapp.js file in yourapp/public/js folder.
In this file, write:

$(document).on("startup", function () {
    if (location.pathname.endsWith("/selling") {
        console.log("I am here! Where are you?"        
    }
;
});

Please, note that
/selling is an example
yourbench is the name of your bench folder on your server
yourapp should be a custom app to preserve your customization in future updates.

Hope this helps.

Thank you.
I somehow managed to call a serverscript via the javascript field in the Custom HTML block to get it working without any custom app.

frappe.call({
    method: "task_list_custom_result",
    callback: function (response) {

Interesting way! I didn’t get what is your exactly requirement? What kind of server side script was needed?

you can use any custom server script with any output to then use that output for display on your workspace ustom html blocks.