Home Analyst Portal

Custom Form - Default value for string or enum properties

Morten_Aulie_PettersMorten_Aulie_Petters Premier Partner IT Monkey ✭
I am looking at the KB for "How To Create Custom Forms for Cireson Portal", trying to spot JSON Tag properties for setting default values for a string or enum property. Is this supported using the js files or do I have to use SM Authoring tools to make changes to the class? This is for Purchase Order CI.

Answers

  • Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
    Yes this is supported. You can find the PurchaseOrder form here: \inetpub\CiresonPortal\Scripts\forms\templates\PurchaseOrder.js

    And then copy it to customSpace folder and modify/add/remove the properties you need. 

    However, if you need to extend with your own custom properties, you will need to extend the class in SCSM as you normally would (via Authoring Tool or VSAE) and then add those in the js file after.
  • Morten_Aulie_PettersMorten_Aulie_Petters Premier Partner IT Monkey ✭
    Thank you Mr. Meisler! But can i modify some of the the properties so that they have a default value when you create a new PO? For example the currency enum property.
  • Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
    edited February 2017
    No this is not possible as far as I know through the json files (sorry for the misunderstanding). You would have to make some custom logic inside your custom.js file inside a form function for PurchaseOrder (similar approach doing tasks with Incidents). In here you can then find the enum-list for currency and set a default value.

    Here is the code I used to set a default value to a enum-list called MessageType (used in Send Email task). It should be similar approach for other enum-lists. I am targetting the .messageTypePickerClass in the DOM, and then modifying the value here.

    <div>//Set default value of message type
    
    </div><div>var messageTypeDefaultId = "d5f78b40-9a0d-0844-8b0d-0c6ca56b436c";
    
    </div><div>                 if (typeof messageTypeDefaultId !== 'undefined') 
                      { </div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var messageTypeDropDownControl = $($(".messageTypePickerClass")[$(".messageTypePickerClass").length - 1]).find('div[data-role="extdropdowntreeviewv3"]').data("kendoExtDropDownTreeViewV3")._dropdown;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; messageTypeDropDownControl.value(messageTypeDefaultId);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
Sign In or Register to comment.