Is there any information on how to use the Auto Value Property that is found in Class > Attributes > Other Properties?
I would like to auto generate a value for the Code attribute in my class.
Is there any information on how to use the Auto Value Property that is found in Class > Attributes > Other Properties?
I would like to auto generate a value for the Code attribute in my class.
Have you found anything?
See the CMDBuild Administrator Manual 3.1 ENG paragraph 6.2.3:
Auto value: you can set the field value in the data Management Module according to other attributes of the form (through javascript code) CMDBuild
First of all, sorry for my bad english.
if you have a class called “CLASS1” with one attribute colled “Attribute1” you can assign auto assign value by the following javascript
document.getElementsByName(“Attribute1”)[0].value = “some value”
By.
Hi Curcar,
do you tested your example for Auto Value that is in Class > Attributes > Other Properties ?
Can you send me your configuration for java script ?
What are values [0] and some value in your script - document.getElementsByName(“Attribute1”)[0].value = “some value”?
And do you tested the field View rules and Validation rules ?
Can you send me your configuration for java script too?
Thank you.
So does anyone have an actual answer for this? There is a grand total of 6 mentions over all the internet scrapped by google for “auto value” and cmdbuild.
The description in the manual is useless and this thread doesn’t contain an actual exemple.
Say I want a property of my card to be the concatenation of a property of the current card and the id of another card. What kind of javascript should I write? What’s the javascript API available?
Hi tecnoteca team, can you attach some example for javascript code.
For any one interested in this matter take a look at the topic “Calculate total number of X”
I have that question too.
So far, here are what I have found out:
To set a value to a particular string, use:
api.setValue(“Test”);
If you want to set the value based on another field’s value (e.g. “Description”), use:
api.bind=[“Description”];
var value=api.record.get(“Description”);
api.setValue(value);
I just saw this post and I wanted to clearify a view thinks on that:
Validation Rules (On Attribute)
depending on the return value, the field is okay or not. If you return true, it will be fine, if you return a string, the string will get displayed as the error message.
as an example:
…
var customer = api.getReferenceCode(“Customer”);
var customerid = api.getValue(“CustomerID”);
var customerstate = api.getLookupCode(“CustomerState”);
if(customer && customerid && customerstate){
return true;
}else{
return “some error”;
}
…
then you need to do the checks you want to do… One tipp: use the return “string” for troubleshooting!
View Rules
The View Rules work nearly the same, but the return value is slightly different.
return true; = field is normaly usable
return false; = field is not shown at all
return “disabled”; = field is shown but cant be changed, useful for fields with autogenerated value.
return “enabled”; = have not yet found a difference to return true
Auto Value
You can set the value of the current field by using api.set() method:
api.setValue(api.getReferenceCode(“OtherRef”)+" - "+api.getValue(“LocalAttr”));
if you want that the Auto Value is only recalculated when there are field changed in some specific fields, you can bind them like that:
api.bind=[“Attr1”,“Attr2”];
otherwise it will recalculate on every change.
hopyfully I could help someone in the future…
How can i retrieve a value from a openmaint/cmdbuild db table and set to the attrribute as auto value?
Hi are you there ? I need some help regarding this topic