Trying to get a widget to act as a first-level validator for my MRVS

thomaskennedy
Kilo Sage

I want to detect duplicate or contradictory entries in my MRVS before releasing the data to a Flow, and to start I want to use client-side JavaScript, Array methods and so on, to catch the most obvious problems. So I want to add a custom variable to my Item, and have it host a widget that $watches the mrvs. This is on my Australia PDI.

 

I added the widget to my item but the client controller never runs, even after stripping out everything but a console statement.

 

Here is what I did. In addition to my mrvs I added a Variable of type Custom.

 

thomaskennedy_0-1791424900990.png

thomaskennedy_1-1791425022028.png

thomaskennedy_2-1791425054776.png

thomaskennedy_3-1791425125077.png

There is nothing under Default Value. I see a few mentions of populating this field as part of this effort, but none are clear enough to be actionable.

thomaskennedy_4-1791425279716.png

The controller:

api.controller = function($scope, $rootScope) {
    var c = this;
    alert( 1 );
    console.log("client controller");
};
 

I started out with a proper $scope.$watch setup and so on, but nothing happened and it showed no sign of monitoring my mrvs, so at length I stripped it down as you see here, but still nothing happens.

 

Have I overlooked something?

 

 

 

2 REPLIES 2

palanikumar
Giga Sage

Hi @thomaskennedy 

 

You can use Catalog Client Script and validate the data before submission. Any specific reason for using the Widget?

 

Thank you,

Palani

Thank you,
Palani

I want to provide immediate feedback before the user even submits, such as if when they add a row that contradicts an existing row - for example if row 3 says to remove Bob as approver on all tasks when row 1 says to add Bob as an approver on XYZ tasks. I want that to run as soon as a row is added or edited, so I can display a summary of problems with the data, and the row numbers. The MRVS event model seems not to support this, hence the need for a widget with a $scope.$watch setup in the controller, watching the mrvs variable. There are many, many articles and posts on this topic but when I try it nothing happens.