yesterday
Hi Experts,
I am trying to build new fiori elements application, where I have to create custom action and in the custom action I will call cap action and expecting some response from CAP. I have to use that response as params to navigate to next object page.
I have tried few option to like below, though my actions is called and but my invoke action promise is always going to catch with error.
changeMaterial: function (oBindingContext, aSelectedContexts) {
let sActionName = "createChangeProductRequest";
let mParameters = {
contexts: oBindingContext,
model: this.getModel(),
label: "Change Material",
invocationGrouping: true,
requiresNavigation: true,
isNavigable: true,
};
// Add console logging for debugging
console.log("Invoking action with parameters:", mParameters);
try {
this.editFlow.invokeAction(sActionName, mParameters)
.then((context) => {
// Optional handling after the promise resolves
console.log("Action completed successfully.", context);
})
.catch((err) => {
console.error("Unexpected error invoking action:", JSON.stringify(err, null, 2));
});
} catch (error) {
console.error("Caught error during invokeAction:", JSON.stringify(error, null, 2));
MessageBox.error("Unexpected error occurred while invoking the action.");
}
}
Any help would be appreciated.
Thanks,
Ram
Hi
Please check these below steps
Step | Description | Example/Details |
1 | Check Custom Action Implementation | Ensure custom action is defined in manifest.json. |
Example: | ||
json "sap.ui.generic.app": { "pages": { "YourPage": { "component": { "customActions": { "YourAction": { "handler": "YourController.YourMethod" } } } } } } | ||
2 | Error Handling | Inspect error messages in catch block. |
Example: Check if error is due to service URL or payload. | ||
3 | Debugging | Use browser developer tools. Look for failed network requests. |
Example: Check Network tab for requests. | ||
4 | Check Set Title Method | Ensure proper parameters are passed. |
Example: Check if title is set correctly. | ```javascript | |
function setTitle(newTitle) { | ||
this.getView().getModel().setProperty("/Title", newTitle); | ||
} | ||
5 | Check SAP UI5 Version | Confirm compatibility of your code with the current version. |
Example: Check sap.ui.core.version in console. | ||
6 | Refer to Documentation | Use official SAP documentation for examples and guidelines. |
Example: SAP Fiori Elements Documentation | http://sapui5.hana.ondemand.com/#/api/sap.ui.generic.app |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
11 | |
10 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.