Transition from button rules that use guidelib.dataIntegrationUtils.executeOperation() to client libs | Community
Skip to main content
December 21, 2023
Question

Transition from button rules that use guidelib.dataIntegrationUtils.executeOperation() to client libs

  • December 21, 2023
  • 2 replies
  • 852 views

I am currently transitioning button rules from an adaptive form to client libs. In my rules I have the following. 

var operationInfo = {
            "formDataModelId": "/content/test/formsanddocuments-fdm/myproject/samplepostgres",
            "operationTitle": "Fetch From Attachment Form",
            "operationName": "fetch"
        };
        var inputs = {
            "id": id.value
        };
        var outputs = {
            "id": id,
            "name": name,
            "description": description
        };
        guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, null, null,);
 
This works as expected. It fetches the data using the id and prepopulates the id, name, and description form fields with the retrieved data. For my client lib I have the following and get the error I have attached:
$(".fetchbutton").click(function () {
        var idNode = guideBridge.resolveNode(
            "guide[0].guide1[0].guideRootPanel[0].attachmentform[0].id[0]"

        );
        var nameNode = guideBridge.resolveNode(
            "guide[0].guide1[0].guideRootPanel[0].attachmentform[0].name[0]"

        );
        var descriptionNode = guideBridge.resolveNode(
            "guide[0].guide1[0].guideRootPanel[0].attachmentform[0].description[0]"

        );
        var idValue = idNode.value;
        var operationInfo = {
            "formDataModelId": "/content/test/formsanddocuments-fdm/myproject/samplepostgres",
            "operationTitle": "Fetch From Attachment Form",
            "operationName": "fetch"
        };
        var inputs = {
            "id": idValue
        };
        var outputs = {
            "id": idNode,
            "name": nameNode,
            "description": descriptionNode
        };
        
        guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, null, null);
 

 

 

2 replies

Sakshi5
Adobe Employee
Adobe Employee
February 7, 2024

I am not able to comprehend the usecase where you want to make it a page level client library. In any case the issue is with 

 var outputs = {
            "id"idNode,
            "name"nameNode,
            "description"descriptionNode
        };
As the thirdparty code will not understand this.

Recommendation is to make it a client library to be associated with form. So on click of a button, you can write a "visual rule" to invoke a custom function (in follwoing example myForm.execute_service). And the clientlibrary will have the js with the custom function looking like:

 

var myForm = window.myForm = window.myForm || {}; /** * @15640518 myForm.execute_service * @90521 {scope} scope in which code inside function will be executed. */ myForm.b2_evacuateIndependently_valueCommit0 = function (scope) { with(scope) { var operationInfo = { "formDataModelId": "/content/test/formsanddocuments-fdm/myproject/samplepostgres", "operationTitle": "Fetch From Attachment Form", "operationName": "fetch" }; var inputs = { "id": id.value }; var outputs = { "id": id, "name": name, "description": description }; guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, null, null,); }

 

Doc link: Check heading "Custom functions in rule editor" in https://experienceleague.adobe.com/docs/experience-manager-65/content/forms/adaptive-forms-advanced-authoring/rule-editor.html?lang=en 

Level 9
June 13, 2024

@sakshi5  some reason the guidelib is undefined for me . In custom client lib . Any dependencies? The myform is empty . I am on AEMaaCS core form component and not using foundation template but new r version of template 

kautuk_sahni
Community Manager
Community Manager
September 25, 2025

@jesus_ibarra Hey! Just wanted to see if this got resolved. If you solved it yourself, sharing your solution could really help others. And if one of the answers here helped you, marking it as accepted will guide future readers. Thanks!

Kautuk Sahni