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:
-
Add a Custom Button in the UI Configuration:
Define a custom button in the UI configuration with a unique ID, label, and action.
-
Fetch the UI Configuration:
Use UI.getConfiguration()
to retrieve the current UI configuration.
-
Get the Entity URI:
Use UI.getEntityUri()
to fetch the URI of the current entity.
-
Make a GET API Call:
Use UI.api()
to make a GET request and fetch the entity details.
-
Validate the Entity:
Check the entity's productType
and identifier.id
to ensure they meet your criteria.
-
Trigger a Webhook (Optional):
If the validation is successful, trigger a webhook or perform any other action.
-
Error Handling:
Add error handling for API calls and validation.
JavaScript Code:
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"]
}
};
UI.getConfiguration()
.then(function (jsonUiConfiguration) {
let entityUri = UI.getEntityUri();
UI.api(entityUri, "GET")
.then(function (response) {
let entity = response.data;
if (entity.productType === "your-product-type" && entity.identifier.id === "your-identifier-id") {
console.log("Validation successful. Entity matches the criteria.");
} else {
console.error("Validation failed. Entity does not match the criteria.");
}
})
.catch(function (error) {
console.error("Error fetching entity details:", error);
});
})
.catch(function (error) {
console.error("Error fetching UI configuration:", error);
});
------------------------------
Varsha Periyasamy
MDM Developer
Majix Solutions Inc
------------------------------
Original Message:
Sent: 02-10-2025 12:54
From: Sharmistha Roy
Subject: UI Customization
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
------------------------------