Based on the roles want to set the field editable

Munna1
Tera Contributor

Hi team,

based on the ' model_manager  ' role I want to make the Price field editable in cmdb_software_product_model table.

So here the Table is cmdb_model and field is product_catalog_item and reference to sc_cat_item.

And this Price field is the dot-walking field from the catalog item.

Munna1_0-1689135031267.png

 

I written one Onload Client script on cmdb_software_product_model table, but it is not working. 

 

function onLoad() {
    if (g_user.hasRole("model_manager")) {            // tried with  g_user.hasRoleExactly() also but not working
       alert("Hello");                                                     // pop up Hello is showing ...
        g_form.setReadOnly('product_catalog_item.price'false);           // tried with different backend names but no use
        g_form.setReadOnly('product_catalog_item'false);
        g_form.setReadOnly('price',false);
    }
    else{
        alert("hi");
        g_form.setReadOnly('price',true);
    }
 

can anyone help me with the script..

 

4 REPLIES 4

Samaksh Wani
Giga Sage
Giga Sage

Hello @Munna1 

 

Plz Check if any other Client Script is written for the same field, maybe it is overriding, which is failing ur script to run.

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

HI @Samaksh Wani ,

Checked all the Client scripts, ACL's and UI policies also... nothing is written on this field...

Check System Policy > Rules > Data Policies for that name.

 

Community Alums
Not applicable

Hi @Munna1 ,

Have you tried creating an ACL?

having operation "Write" for that specific role.