Reltio Connect

 View Only
  • 1.  UI Customization

    Reltio Partner
    Posted 02-10-2025 12:55

    Hi All,

    I want to create a custom button in UI. On clicking the button, it should check for the product type of entity and its identifier id, if the validation meets it will trigger a webhook. For implementing  the same, i have to do a get call for the entity URI, but i am not getting reference how to incorporate the Get api call  in javascript. Have used the below Reltio documentation but could not do much .Can anyone help here.

    Reltio Documentation Link -https://docs.reltio.com/en/objectives/configure-the-reltio-ui/ui-configuration-at-a-glance/ui-custom-components/script#getconfiguration-0

    Regards,

    Sharmistha



    ------------------------------
    Sharmistha Roy
    Fresh Gravity
    ------------------------------


  • 2.  RE: UI Customization

    Founding Member
    Posted 02-12-2025 15:24

    I would suggest to built a RIH recipe which can be triggered via API platform. Recipe can take care of all you want to achieve in background, this would require registering proxy Reltio API which can be done by Reltio support



    ------------------------------
    Ashish Rawat
    Sr. Manager
    Fresh Gravity
    Bangalore
    ------------------------------



  • 3.  RE: UI Customization

    Posted 30 days ago

    Hi, 

    I don't know whether the answer is correct or not, but in RIA the answer is like this.

    To create a custom button in the UI and make a GET API call to fetch the entity URI, you can follow these steps. Below is a modified and more detailed version of the script, including error handling and additional comments for clarity:

    Steps:

    1. Add a Custom Button in the UI Configuration:
      Define a custom button in the UI configuration with a unique ID, label, and action.

    2. Fetch the UI Configuration:
      Use UI.getConfiguration() to retrieve the current UI configuration.

    3. Get the Entity URI:
      Use UI.getEntityUri() to fetch the URI of the current entity.

    4. Make a GET API Call:
      Use UI.api() to make a GET request and fetch the entity details.

    5. Validate the Entity:
      Check the entity's productType and identifier.id to ensure they meet your criteria.

    6. Trigger a Webhook (Optional):
      If the validation is successful, trigger a webhook or perform any other action.

    7. Error Handling:
      Add error handling for API calls and validation.

    JavaScript Code:

    // Define the custom button
    let button = {
        "point": "com.reltio.plugins.ui.button",
        "id": "com.reltio.plugins.CustomButton",
        "class": "com.reltio.plugins.ui.actions.CustomAction",
        "label": "Custom Button",
        "action": {
            "files": ["https://your-script.js"] // Replace with the URL of your custom script
        }
    };
    
    // Fetch the UI configuration
    UI.getConfiguration()
        .then(function (jsonUiConfiguration) {
            // Get the entity URI
            let entityUri = UI.getEntityUri();
    
            // Make a GET API call to fetch entity details
            UI.api(entityUri, "GET")
                .then(function (response) {
                    let entity = response.data;
    
                    // Validate the entity's product type and identifier ID
                    if (entity.productType === "your-product-type" && entity.identifier.id === "your-identifier-id") {
                        // Validation successful
                        console.log("Validation successful. Entity matches the criteria.");
    
                        // Trigger a webhook or perform any other action here
                        // Example: UI.triggerWebhook("https://your-webhook-url", { entity: entity });
                    } else {
                        // Validation failed
                        console.error("Validation failed. Entity does not match the criteria.");
                    }
                })
                .catch(function (error) {
                    // Handle API call errors
                    console.error("Error fetching entity details:", error);
                });
        })
        .catch(function (error) {
            // Handle errors in fetching UI configuration
            console.error("Error fetching UI configuration:", error);
        });


    ------------------------------
    Varsha Periyasamy
    MDM Developer
    Majix Solutions Inc
    ------------------------------