Getting OptionSet value and setting Label Name based on Value

0
42
Role Image


Hi all, 

Could anyone help me understand why this code doesn’t work? I’m trying to get the option set value of a field, and if it’s “C”, then set the label name to Celius. Here’s my code:

function onload(executionContext) {
	debugger 
	if (executionContext == null)
		return;
	var formContext = executionContext.getFormContext();
	oppForm(executionContext);

};

function oppForm(executionContext) {
	debugger
	if (executionContext == null)
		return;
	var formContext = executionContext.getFormContext();
	var optionSetLabelName = formContext.getControl("dom_temperature");
	var optionSetChoice = formContext.getAttribute("dom_temperature").getText();
	console.log(optionSetChoice);
		
	if (optionSetChoice == null) {
		return;
	if (optionSetChoice == ("C")) {
		formContext.getControl("dom_temperature").setLabel("Celsius");
		}
		}
};



Source link

Leave a reply

Please enter your comment!
Please enter your name here