CMDBuild Forum

Attributes View rules?

How can I use View Rules on Attributes?  Manual says I can make the attribute hidden or not editable according to the value of other attributes in the form.  Got an example of this?

 

2 Likes

Previously Geto wrote:

How can I use View Rules on Attributes?  Manual says I can make the attribute hidden or not editable according to the value of other attributes in the form.  Got an example of this?

 

Can anyone in this forum share how do you use JavaScript within CMDBuild? Is there another forum where peers meet that I don't know?  I'm just a regular user and nowhere near a developer so I would love just a bit of direction. 
 
Anyone???....
 
Bueller?
 
 
2 Likes

Hi,

Here’s an example, maybe ist to late, but for new visitors.

// if mode is read, and Value from <FieldName> is empty <FieldName> is hidden.
if (api.mode == "read" && api.getValue('<FieldName>') == null)
return false;
// default visible
return true;

You can show a lot of info with console.log command. for example you can show all Info about api if you write in “view rules” box
console.log(api);

I hope this can help someone.

Best regards.

3 Likes

Hello, how do I make attribute mandatory, if another attribute is not null?
I have rule to view field, like

if (api.getValue("DLCG") == null)
return false;
// default invisible
return true;

and need to add return true AND make mandatory