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

Avatar

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile
sureshp20051226
Level 2

28-04-2021

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 

Replies

Avatar

Avatar
Boost 1
Level 2
sureshp23286254
Level 2

Like

1 like

Total Posts

20 posts

Correct reply

1 solution
Top badges earned
Boost 1
Validate 1
Ignite 3
Ignite 1
Give Back
View profile

Avatar
Boost 1
Level 2
sureshp23286254
Level 2

Like

1 like

Total Posts

20 posts

Correct reply

1 solution
Top badges earned
Boost 1
Validate 1
Ignite 3
Ignite 1
Give Back
View profile
sureshp23286254
Level 2

28-04-2021

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");
}

Avatar

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile
MorisMonk
Level 2

29-04-2021

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

Avatar

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile
sureshp20051226
Level 2

30-04-2021

@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".

Avatar

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile
MorisMonk
Level 2

02-05-2021

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?

Avatar

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile
sureshp20051226
Level 2

03-05-2021

@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.

Avatar

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile

Avatar
Give Back 5
Level 2
MorisMonk
Level 2

Likes

9 likes

Total Posts

12 posts

Correct reply

1 solution
Top badges earned
Give Back 5
Affirm 1
Boost 5
Give Back 3
Boost 3
View profile
MorisMonk
Level 2

03-05-2021

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.

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

04-05-2021

@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

 

Avatar

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile

Avatar
Boost 5
Level 2
sureshp20051226
Level 2

Likes

5 likes

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Boost 5
Boost 3
Give Back 3
Give Back
Ignite 1
View profile
sureshp20051226
Level 2

04-05-2021

@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  🙂

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

04-05-2021

@sureshp20051226  show them this post 🙂