Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM InvokeService and guideBridege.validate() don't work together

sureshp20051226
Level 2
Level 2

Hi All,
We have a serious issue with AEM InvokeService (i.e. guidelib.dataIntegrationUtils.executeOperation() ) and guideBridege.validate() as the invokeService never terminates after guideBride.validate() returns true. We have an adaptive form consisting of 6 tabs and 6th tab is Review and Submit. Once user clicks on Submit button(type="button"), i will run guideBride.validate on each tab and once it returns true, i will invokeService which could be either POST (If user hasn't saved the form) or PUT operation. If I disable the validation then the form gets submitted but if i enable the validation, it shows the errors messages for all required fields if they are left blank and finally control goes to executeOperation but never exits.

In the sample code below we are never going to see "after fdm" in the console after successfull validation. But if i disable guideBridge.validate then form will get submitted and we can see the log message "after fdm" in browser console.


var operationInfo = {
"formDataModelId": "/content/dam/formsanddocuments-fdm/test",
"operationTitle": "Get data",
"operationName": "get_16166693155410"
};
var inputs = {
"id" : id_1,
"name" : name_1,
"frmDate" : date
};
var outputs = {
};
var createResponse = function(jsonResult){
alert("jsonREsult="+jsonResult);
};
var ci_errors = [];
guideBridge.validate(ci_errors,"guide[0].guide1[0].guideRootPanel[0]",true);
if(ci_errors.length === 0 ) {
console.log("Inside err len ===0 ");
guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, createResponse);
console.log("after fdm");
}

Because of this issue we couldn't proceed with UAT and request you all if you could take some time to troubleshoot this issue or if there is any other alternate implementation.

If it is a simple POST operation then guideBridge.submit() works fine with guideBridege.validate(). We have issue only with InvokeService and guideBridege.validate().

Please let me know if you need any additional details.



Thanks & Regards
Suresh

 

@Mayank_Gandhi 

@workflowuser 

9 Replies
sureshp23286254
Level 2
Level 2

Since i couldn't upload the TestForm, I tried to provide the code of Submit button where we can that "after fdm" will never print in the browser console after succcessful validation 3 required fields.

 

 

var operationInfo = {
"formDataModelId": "/content/dam/formsanddocuments-fdm/test",
"operationTitle": "Get data",
"operationName": "get_16166693155410"
};
var inputs = {
"id" : id_1,
"name" : name_1,
"frmDate" : date
};
var outputs = {
};
var createResponse = function(jsonResult){
alert("jsonREsult="+jsonResult);
};
var ci_errors = [];
guideBridge.validate(ci_errors,"guide[0].guide1[0].guideRootPanel[0]",true);
if(ci_errors.length === 0 ) {
console.log("Inside err len ===0 ");
guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, createResponse);
console.log("after fdm");
}

Mayank_Gandhi
Community Advisor
Community Advisor

@sureshp20051226 This is something I have previously seen. You might want to move the fdm and validate on two different fields. The context is lost with the initial approach that you have taken. 

Suggested approach: 

on validate -> fire an event from the current field and catch it on another field and let the other field call the FDM

 

sureshp20051226
Level 2
Level 2

@Mayank_Gandhi@MorisMonk  Thanks a lot for your support on troubleshooting this. Initially i tried to move the validations to a hidden field "validationFlg" and on Submit i used to read this value but it didn't work. Now based on your suggestions  i tried to keep additional button "Validate" and moved the validation logic to onClick of this button and upon successful validation i enable the Submit button. This approach does seems to work but not sure If i can convenience out business about introduction of new button "Validate". however this does seems like a work around solution till Adobe provide a fix for this. will keep you updated once i implement this to my actual form. 

Thanks again  🙂

MorisMonk
Level 3
Level 3
Hi Suresh. I am assuming you can see the "Inside err len ===0 " before "after fdm" in your console log? Are there any errors in your console log? Or error.log ? Can you tell if the record is being created? Cheers Moris
sureshp20051226
Level 2
Level 2
@MorisMonk there are no other errors. if I enter values in 3 fields then i could see message "Inside err len ===0" and invokeService do not seems to get triggered and not seeing the next console log "after fdm".
MorisMonk
Level 3
Level 3

After the guidelib.dataIntegrationUtils.executeOperation fires, do you see "guideContainer.af.dermis" in the Network tab of your browser console?

And do you have any Validate expressions in your form?

sureshp20051226
Level 2
Level 2
@MorisMonk I just have additional future date validation on the date picker and once i disabled it then i could see form getting invoked and could see guideContainer.af.dermis in the network tab. if we have any validation rule then i think it is getting failed.
MorisMonk
Level 3
Level 3

Nice work. I reproduced the same. Have you raised a case with Adobe Support?

Workaround? Can you move the validation to another area of the form, have the Submit button initially disabled?

Example, a Terms and Conditions type of checkbox just above the Submit button that does the Validate and enables the button.