Skip to Content

Selecting default values in MDK Asset Manager

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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jun 26 at 01:53 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.