BTUSA
September 25, 2023, 1:22pm
#1
Hi all,
I would like your help here.
I’d like to set an auto value for a field, so when someone creates a card, a specified field is supposed to get a specified value in advance, therefore you don’t have to fill it out every time.
Can you provide me a complete javascript, and i will see how can integrate a code in general as well?
Thank you in advance,
LB
Hi,
This is my code to auto value, the code include: set value, get from reference, if you wanna more, can console.log(api)
globalThis.api = api;
api.bind = ["TLCInfraBoxCabinet"];
var pCode = api.getReferenceCode("TLCInfraBoxCabinet");
var code = api.getValue("Code");
if (typeof(pCode) != "undefined" && pCode != null) {
if (typeof(code) == "undefined" || code == null) {
api.setValue(pCode + ".");
} else if (code.indexOf(pCode) < 0) {
api.setValue(pCode + ".");
}
}
I use globalThis.api = api; to set ref of api to window instance, then you can use it in console.log
BTUSA
October 13, 2023, 9:19am
#3
Hi
A BIG thanks to you, it could resolve my problem.
I’ve got one more brief question, if you could help me in this case too:
I’d like to create conditional fields as well, for eg.: show only “X” field when “Y” field is set to a certain value.
I’D really really appreciate a solution for that!
BR
1 Like