Anyone know how to customize WI form based on data in the viewModel
if (pageForm.viewModel.Category.Name == "Urgent") {
{ DataType: "String", PropertyDisplayName: "Reason for Urgency", PropertyName: "ReasonForUrgency", Required: true, },}
Both ..Category.Name and ReasonForUrgency are custom extensions, but it could be anything, really. I am noticing that the pageForm.viewModel does not appear to be available at load of the ChangeRequest.js file to logic off of. Please let me know if you have any recommendations.
Best Answer
-
Tom_Hendricks Customer Super IT Monkey ✭✭✭✭✭Put your logic in custom.js, either in
$(document).ready(function() { **HERE** };
orapp.custom.formTasks.add('ChangeRequest', null, function (formObj, viewModel) { formObj.boundReady(function () {
**HERE**
});
});
That way it will load after the viewModel is loaded. The second way might be the best fit for what you are describing.
You wouldn't be adding your field (or not)--the fields will be defined in ChangeRequest.js--you would be hiding the fields after they are rendered (or not).
1
Answers
or
That way it will load after the viewModel is loaded. The second way might be the best fit for what you are describing.
You wouldn't be adding your field (or not)--the fields will be defined in ChangeRequest.js--you would be hiding the fields after they are rendered (or not).
Sorry for any confusion!