I want to filter the change approver lookup based on some conditions. I tried to find the module that is responsible for this but couldn't find it. Can anyone help me on this?

Like 2

Like

1 comments
Best reply

Hello,

 

When clicking the "Change approver" button the ApprovalDashboardItemViewModel module onChangeApproverButtonClick method is called. This onChangeApproverButtonClick method calls the changeVizierAction method from the BaseVisaProvider module. Lookup opening is performed in this part of code (inside the checkRightCallback callback method):

LookupUtilities.OpenLookup({
						sandbox: sandbox,
						lookupConfig: lookupConfig,
						renderTo: renderTo || Ext.get("centerPanel"),
						cancelCallback: cancelCallbackFn
					}, lookupUtilitiesCallback, this);

Unfortunately filters cannot be added at this point based on the OpenLookup method from the LookupUtilities.

Hello,

 

When clicking the "Change approver" button the ApprovalDashboardItemViewModel module onChangeApproverButtonClick method is called. This onChangeApproverButtonClick method calls the changeVizierAction method from the BaseVisaProvider module. Lookup opening is performed in this part of code (inside the checkRightCallback callback method):

LookupUtilities.OpenLookup({
						sandbox: sandbox,
						lookupConfig: lookupConfig,
						renderTo: renderTo || Ext.get("centerPanel"),
						cancelCallback: cancelCallbackFn
					}, lookupUtilitiesCallback, this);

Unfortunately filters cannot be added at this point based on the OpenLookup method from the LookupUtilities.

Show all comments

Hi Community,

 

I wanted to implement a funtionality where a validation should happen on click of Approve button. If the valiation fails the approval should not happen.

 

To achive the above task I tried with the following approaches, on the "UsrReturns" custom object.

  1. Tried to implement "asyncValidate" on "UsrReturnsVisaPageV2", but it didn't work (Seems the approval is happening outside the context of this page). Also not sure what is the use of this page.
  2. Tried to implement validation using Entity Events Layer on the object "UsrReturnsVisa". Although it didn't approve the request, but it didn't throw the exception as well with the following code,
    if(true){
    	throw new Exception("Can not approve");
    }
    return true;
  3. Tried to implement a custom approval logic using "ApprovalDashboardItemViewModel", but I can not create a replacing schema with this.

So need a way to implement such funtionality. Any suggestions will help.

 

Thanks & Regards,

Sourav Kumar Samal

Like 0

Like

3 comments

Hello,

 

Can you please screenshot the exact button you click, clicking which should start the validation process?

 

Thank you!

 

Best regards,

Oscar

Oscar Dylan,

While clicking Approve on notification panel as shown below,

 

 

Also while clicking under DCM & from Approvals section, same error shows on the console, but popup doesn't come.

 

Regards,

Sourav

Sourav Kumar Samal,

 

this is a bad request response returned by the app and we need to see the actual response (from the "Response" tab of the request in the "Network" tab).

 

To add some logic upon approval you need to replace the "approve" method in the "VisaNotificationsSchema" module (for "reject" actions its "reject" method). You will be in the context of the approval record and you can use data from there to process further with the approval\rejection. So you need to override the logic of these two methods.

 

Best regards,

Oscar

Show all comments

Hi community!

We have created replacing schema - VisaNotificationsSchema. In VisaNotificationsSchema we added code to hide "Reject" and "Change approver" buttons. We want to apply it for specified objects . To do it we need to retrieve object Id from Approval. Any suggestions how can we do it?

Best regards, 

Jana

 

Like 0

Like

1 comments

Hi Yana,

 

I just prepared working example so You can adopt it to Your case

 define("VisaNotificationsSchema", function() {
   return {
      methods: {
 
         getVisaActionButtonMenu: function() {
            var menu = this.get("VisaActionButtonMenu");
            if (!Ext.isEmpty(this.values) ? this.values.SchemaName=='Opportunity' : false) {
               menu.removeByIndex(1);
               menu.removeByIndex(1);
               menu.removeByIndex(1);
            }
            return menu;
         }
      },
      diff: [
         {
            "operation": "merge",
            "name": "VisaActionButton",
            "parentName": "NotificationItemTopContainer",
            "propertyName": "items",
            "values": {
               "itemType": Terrasoft.ViewItemType.BUTTON,
               "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
               "classes": {"wrapperClass": ["visaActionButtonWrap-class"]},
               "caption": {"bindTo": "Resources.Strings.VisaActionButton"},
               "prepareMenu": {"bindTo": "selectNotificationItemOnActionButtonClick"},
               "menu": {
                  "items": {"bindTo": "getVisaActionButtonMenu"}
               }
            }
         }
      ]
   };
});

Best regards,

Marcin

Show all comments