on 06-25-2020 1:58 PM
We are trying to do a simple enhancement to pre-select a default value on the ControlKeyLstPkr control of WorkOrderOperationCreateUpdate.page
The Value property of the ControlKeyLstPkr control is set to a new rule with the following code:
export default function WorkOrderOperationControlKey(context) {
var page = context.getPageProxy().getControl('FormCellContainer');
var targetList = page.getControl('ControlKeyLstPkr');
var binding = targetList.getBindingObject();
binding.ControlKey = 'PM01';
return targetList.setValue(binding.ControlKey);
}
We have verified the rule is executed and PM01 is in the list, but the default value is not set. Any thoughts on what we are doing wrong here?
Scott,
For your rule, to set the default value the rule should be returning the actual value "PM01" in this case. Since the page is used for both Create and Update, your rule will need to determine which mode the page is being used for and either return the resolved value of {ControlKey} for edit or just return PM01 for create.
--Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bill - we switched it to just return the string value 'PM01' (just testing the "add" scenario for now) but still no default is selected. I'm wondering if there is something else about the way the control is defined that doesn't allow the value to select.? The alert does pop up so we know it is getting to the case.
case 'ControlKeyLstPkr':
alert("WorkOrderOperationCreateDefault.js function");
return 'PM01';
This was changed in the WorkOrderOperationCreateUpdateDefault.js as that seemed like a more appropriate place to set the value.
Scott
Scott,
Your rule is using the correct method to set a value for the list picker and is actually working as expected. However, in the case of the Asset Manager application, in the OnLoaded event of the WorkOrderOperationCreateUpdate.page the default code is setting a default value for the Control Key that overwrites the default value from your rule.
The SAM 2005 code sets the Control Key to the Parent Work Order OrderType value. If the Order Type is not a valid choice in the Control Key picker the default will be blank. But if the parent work order type is PM01 then the Control Key will be defaulted to PM01.
Hope this helps clarify.
--Bill
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.